/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import * as types from "../../types/primitives.js"; import { ErrorCode, ErrorCode$inboundSchema } from "./error-code.js"; import { FlexPriceError } from "./flex-price-error.js"; export type ErrorsErrorResponseData = { code?: ErrorCode | undefined; httpStatusCode?: number | undefined; message?: string | undefined; }; export class ErrorsErrorResponse extends FlexPriceError { code?: ErrorCode | undefined; httpStatusCode?: number | undefined; /** The original data that was passed to this error instance. */ data$: ErrorsErrorResponseData; constructor( err: ErrorsErrorResponseData, 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; if (err.httpStatusCode != null) this.httpStatusCode = err.httpStatusCode; this.name = "ErrorsErrorResponse"; } } /** @internal */ export const ErrorsErrorResponse$inboundSchema: z.ZodMiniType< ErrorsErrorResponse, unknown > = z.pipe( z.object({ code: types.optional(ErrorCode$inboundSchema), http_status_code: types.optional(types.number()), message: types.optional(types.string()), request$: z.custom(x => x instanceof Request), response$: z.custom(x => x instanceof Response), body$: z.string(), }), z.transform((v) => { const remapped = remap$(v, { "http_status_code": "httpStatusCode", }); return new ErrorsErrorResponse(remapped, { request: v.request$, response: v.response$, body: v.body$, }); }), );