import { z } from "zod"; /** * Wire shape for errors thrown across the RPC boundary. The fields are * the union of (a) the legacy `QvacErrorBase` serialisation (`name`, * `code`, `message`, `stack`, `cause`, `timestamp`) and (b) the new * `typedFields` map (0.11.0+) carrying per-class structured data the * client-side reconstructor uses to rebuild the original typed error. * * `typedFields` is opaque on the wire — `z.unknown()` — and the * per-class reconstructor in `client/rpc/rpc-error.ts` casts each * member at the boundary. The single-map shape keeps the schema * compact regardless of how many typed-error classes the SDK * eventually surfaces across RPC. New typed-error classes that need * cross-RPC reconstruction add a `toErrorResponseFields()` method on * the server side and a row to the reconstructor map on the client * side; the schema itself doesn't change. */ export declare const errorResponseSchema: z.ZodObject<{ type: z.ZodLiteral<"error">; message: z.ZodString; stack: z.ZodOptional; timestamp: z.ZodOptional; name: z.ZodOptional; code: z.ZodOptional; cause: z.ZodOptional; typedFields: z.ZodOptional>; }, z.core.$strip>; export type ErrorResponse = z.infer; /** * A `QvacErrorBase` subclass that opts into typed-field serialisation * across the RPC boundary. The method returns the subset of own * properties the client-side reconstructor needs to rebuild the * original class with its named constructor arguments populated. * * Co-located with each class (see `utils/errors-server.ts`) so adding * a new cross-RPC typed error is a three-step change in one PR: define * the class, implement the method, add a reconstructor entry in * `client/rpc/rpc-error.ts`. */ export interface TypedErrorSerializer { toErrorResponseFields(): Record; } export declare function createErrorResponse(error: unknown): ErrorResponse; //# sourceMappingURL=error.d.ts.map