/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import * as types from "../../types/primitives.js"; import * as models from "../index.js"; import { SDKError } from "./sdk-error.js"; /** * Memory error response. */ export type ErrorResponseData = { error?: models.ErrorT | undefined; [additionalProperties: string]: unknown; }; /** * Memory error response. */ export class ErrorResponse extends SDKError { error?: models.ErrorT | undefined; /** The original data that was passed to this error instance. */ data$: ErrorResponseData; constructor( err: ErrorResponseData, 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; if (err.error != null) this.error = err.error; this.name = "ErrorResponse"; } } /** @internal */ export const ErrorResponse$inboundSchema: z.ZodMiniType< ErrorResponse, unknown > = z.pipe( z.object({ error: types.optional(z.lazy(() => models.ErrorT$inboundSchema)), request$: z.custom(x => x instanceof Request), response$: z.custom(x => x instanceof Response), body$: z.string(), }), z.transform((v) => { return new ErrorResponse(v, { request: v.request$, response: v.response$, body: v.body$, }); }), );