/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { ProveapiError } from "./proveapierror.js"; /** * Error400 is a custom error for HTTP 400. This is used to support distinguishing * * @remarks * between HTTP 400 and 500 in Speakeasy SDKs. */ export type Error400Data = { /** * Code is an internal error code that describes the problem category of the request. */ code?: number | undefined; /** * Message is an error message describing the problem with the request. */ message: string; }; /** * Error400 is a custom error for HTTP 400. This is used to support distinguishing * * @remarks * between HTTP 400 and 500 in Speakeasy SDKs. */ export class Error400 extends ProveapiError { /** * Code is an internal error code that describes the problem category of the request. */ code?: number | undefined; /** The original data that was passed to this error instance. */ data$: Error400Data; constructor( err: Error400Data, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.code != null) this.code = err.code; this.name = "Error400"; } } /** @internal */ export const Error400$inboundSchema: z.ZodType< Error400, z.ZodTypeDef, unknown > = z.object({ code: z.number().int().optional(), message: z.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new Error400(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type Error400$Outbound = { code?: number | undefined; message: string; }; /** @internal */ export const Error400$outboundSchema: z.ZodType< Error400$Outbound, z.ZodTypeDef, Error400 > = z.instanceof(Error400) .transform(v => v.data$) .pipe(z.object({ code: z.number().int().optional(), message: z.string(), })); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Error400$ { /** @deprecated use `Error400$inboundSchema` instead. */ export const inboundSchema = Error400$inboundSchema; /** @deprecated use `Error400$outboundSchema` instead. */ export const outboundSchema = Error400$outboundSchema; /** @deprecated use `Error400$Outbound` instead. */ export type Outbound = Error400$Outbound; }