/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { RagieError } from "./ragieerror.js"; export type ErrorMessageData = { detail: string; }; export class ErrorMessage extends RagieError { detail: string; /** The original data that was passed to this error instance. */ data$: ErrorMessageData; constructor( err: ErrorMessageData, 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; this.detail = err.detail; this.name = "ErrorMessage"; } } /** @internal */ export const ErrorMessage$inboundSchema: z.ZodType< ErrorMessage, z.ZodTypeDef, unknown > = z.object({ detail: z.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new ErrorMessage(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type ErrorMessage$Outbound = { detail: string; }; /** @internal */ export const ErrorMessage$outboundSchema: z.ZodType< ErrorMessage$Outbound, z.ZodTypeDef, ErrorMessage > = z.instanceof(ErrorMessage) .transform(v => v.data$) .pipe(z.object({ detail: z.string(), }));