{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export class PrismicError<Response> extends Error {\n\turl?: string\n\tresponse: Response\n\n\tconstructor(\n\t\tmessage = \"An invalid API response was returned\",\n\t\turl: string | undefined,\n\t\tresponse: Response,\n\t) {\n\t\tsuper(message)\n\n\t\tthis.url = url\n\t\tthis.response = response\n\t}\n}\n\ntype ForbiddenErrorRepositoryAPIResponse = {\n\ttype: string\n\tmessage: string\n}\n\ntype ForbiddenErrorQueryAPIResponse = {\n\terror: string\n}\n\nexport class ForbiddenError<\n\tTResponse = ForbiddenErrorRepositoryAPIResponse | ForbiddenErrorQueryAPIResponse,\n> extends PrismicError<TResponse> {}\n\nexport class NotFoundError<TResponse = undefined> extends PrismicError<TResponse> {}\n\nexport class RepositoryNotFoundError<TResponse = undefined> extends NotFoundError<TResponse> {}\n\ntype ParsingErrorAPIResponse = {\n\ttype: \"parsing-error\"\n\tmessage: string\n\tpos: {\n\t\tline: number\n\t\tcolumn: number\n\t\tid: number\n\t\tlocation: string\n\t}\n}\n\nexport class ParsingError<TResponse = ParsingErrorAPIResponse> extends PrismicError<TResponse> {}\n\nexport class InvalidDataError<TResponse = undefined> extends PrismicError<TResponse> {}\n\ntype RefExpiredErrorAPIResponse = {\n\ttype: \"api_validation_error\"\n\tmessage: string\n}\n\n// This error extends `ForbiddenError` for backwards compatibility. Before the\n// API started returning 410 for expired refs, it returned 403, which threw a\n// `ForbiddenError`.\n// TODO: Extend this error from `PrismicError` in v8.\nexport class RefExpiredError<\n\tTResponse = RefExpiredErrorAPIResponse,\n> extends ForbiddenError<TResponse> {}\n\ntype RefNotFoundErrorAPIResponse = {\n\ttype: \"api_notfound_error\"\n\tmessage: string\n}\n\n// This error extends `ForbiddenError` for backwards compatibility. Before the\n// API started returning 404 for not found refs, it returned 403, which threw a\n// `ForbiddenError`.\n// TODO: Extend this error from `PrismicError` in v8.\nexport class RefNotFoundError<\n\tTResponse = RefNotFoundErrorAPIResponse,\n> extends ForbiddenError<TResponse> {}\n\ntype PreviewTokenExpiredErrorAPIResponse = {\n\ttype: \"api_security_error\"\n\tmessage: string\n}\n\n// This error extends `ForbiddenError` for backwards compatibility.\n// TODO: Extend this error from `PrismicError` in v8.\nexport class PreviewTokenExpiredError<\n\tTResponse = PreviewTokenExpiredErrorAPIResponse,\n> extends ForbiddenError<TResponse> {}\n"],"mappings":";AAAA,IAAa,eAAb,cAA4C,MAAM;CACjD;CACA;CAEA,YACC,UAAU,wCACV,KACA,UACC;AACD,QAAM,QAAQ;AAEd,OAAK,MAAM;AACX,OAAK,WAAW;;;AAalB,IAAa,iBAAb,cAEU,aAAwB;AAElC,IAAa,gBAAb,cAA0D,aAAwB;AAElF,IAAa,0BAAb,cAAoE,cAAyB;AAa7F,IAAa,eAAb,cAAuE,aAAwB;AAE/F,IAAa,mBAAb,cAA6D,aAAwB;AAWrF,IAAa,kBAAb,cAEU,eAA0B;AAWpC,IAAa,mBAAb,cAEU,eAA0B;AASpC,IAAa,2BAAb,cAEU,eAA0B"}