/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import * as components from "../components/index.js"; import { Gr4vyError } from "./gr4vyerror.js"; export type Error502Data = { /** * Always `error`. */ type?: "error" | undefined; /** * Always `bad_gateway` */ code?: string | undefined; /** * Always `502`. */ status?: number | undefined; /** * A human readable message that provides more context to the error. */ message?: string | undefined; /** * A list of details that further ellaborate on the error. */ details?: Array | undefined; }; export class Error502 extends Gr4vyError { /** * Always `error`. */ type?: "error" | undefined; /** * Always `bad_gateway` */ code?: string | undefined; /** * Always `502`. */ status?: number | undefined; /** * A list of details that further ellaborate on the error. */ details?: Array | undefined; /** The original data that was passed to this error instance. */ data$: Error502Data; constructor( err: Error502Data, 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.type != null) this.type = err.type; if (err.code != null) this.code = err.code; if (err.status != null) this.status = err.status; if (err.details != null) this.details = err.details; this.name = "Error502"; } } /** @internal */ export const Error502$inboundSchema: z.ZodType< Error502, z.ZodTypeDef, unknown > = z.object({ type: z.literal("error").default("error"), code: z.string().default("bad_gateway"), status: z.number().int().default(502), message: z.string().default("Request could not be processed"), details: z.array(components.ErrorDetail$inboundSchema).optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new Error502(v, { request: v.request$, response: v.response$, body: v.body$, }); });