{"version":3,"file":"content-filter-error.mjs","names":[],"sources":["../../../../../../../ai/src/errors/content-filter-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { ProviderError } from \"./provider-error\";\n\n/**\n * Payload for `ContentFilterError`. Both fields optional — providers\n * don't consistently disclose the specific filter reason or\n * categories, especially when the block is pre-generation.\n */\nexport type ContentFilterErrorOptions = AIErrorOptions & {\n  reason?: string;\n  categories?: string[];\n};\n\n/**\n * Response (or request) was blocked by the provider's safety filter.\n * Not retryable with the same input — reshape the prompt or lean on\n * a less-restrictive model.\n *\n * @example\n * if (result.error instanceof ContentFilterError) {\n *   return respondWithPolicyMessage(result.error.reason);\n * }\n */\nexport class ContentFilterError extends ProviderError {\n  public static readonly defaultCategory: ErrorCategory = \"content-filter\";\n\n  public readonly reason?: string;\n  public readonly categories?: string[];\n\n  public constructor(message: string, options?: ContentFilterErrorOptions) {\n    super(message, options, \"CONTENT_FILTER\");\n    this.name = \"ContentFilterError\";\n    this.reason = options?.reason;\n    this.categories = options?.categories;\n  }\n}\n"],"mappings":";;;;;;;;;;;;;AAwBA,IAAa,qBAAb,cAAwC,cAAc;;yBACI;;CAKxD,AAAO,YAAY,SAAiB,SAAqC;EACvE,MAAM,SAAS,SAAS,gBAAgB;EACxC,KAAK,OAAO;EACZ,KAAK,SAAS,SAAS;EACvB,KAAK,aAAa,SAAS;CAC7B;AACF"}