/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 7604a9e043c6 */ import * as z from "zod/v3"; import * as components from "../components/index.js"; import { GleanBaseError } from "./gleanbaseerror.js"; export type CollectionErrorData = { errorCode: components.CollectionErrorErrorCode; }; export class CollectionError extends GleanBaseError { errorCode: components.CollectionErrorErrorCode; /** The original data that was passed to this error instance. */ data$: CollectionErrorData; constructor( err: CollectionErrorData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.errorCode = err.errorCode; this.name = "CollectionError"; } } /** @internal */ export const CollectionError$inboundSchema: z.ZodType< CollectionError, z.ZodTypeDef, unknown > = z.object({ errorCode: components.CollectionErrorErrorCode$inboundSchema, request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new CollectionError(v, { request: v.request$, response: v.response$, body: v.body$, }); });