/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import * as types from "../types/primitives.js"; import { Issue, Issue$inboundSchema, Issue$Outbound, Issue$outboundSchema, } from "./issue.js"; import { VercelError } from "./vercelerror.js"; /** * The request did not match the expected schema */ export type HttpApiDecodeErrorData = { issues: Array; message: string; }; /** * The request did not match the expected schema */ export class HttpApiDecodeError extends VercelError { issues: Array; /** The original data that was passed to this error instance. */ data$: HttpApiDecodeErrorData; constructor( err: HttpApiDecodeErrorData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.issues = err.issues; this.name = "HttpApiDecodeError"; } } /** @internal */ export const HttpApiDecodeError$inboundSchema: z.ZodType< HttpApiDecodeError, z.ZodTypeDef, unknown > = z.object({ issues: z.array(Issue$inboundSchema), message: types.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new HttpApiDecodeError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type HttpApiDecodeError$Outbound = { issues: Array; message: string; }; /** @internal */ export const HttpApiDecodeError$outboundSchema: z.ZodType< HttpApiDecodeError$Outbound, z.ZodTypeDef, HttpApiDecodeError > = z.instanceof(HttpApiDecodeError) .transform(v => v.data$) .pipe(z.object({ issues: z.array(Issue$outboundSchema), message: z.string(), }));