/** * Error categories for domain-based grouping and handling */ export type ErrorCategory = "CONFIG" | "BUILD" | "RUNTIME" | "ROUTE" | "MODULE" | "SERVER" | "BOUNDARY" | "DEV" | "DEPLOY" | "AGENT" | "GENERAL"; /** * RFC 9457 Problem Details response shape */ export interface RFC9457Response { type: string; title: string; status: number; detail?: string; instance?: string; category: ErrorCategory; suggestion?: string; cause?: string; } /** * Error definition for the registry */ export interface ErrorDefinition { slug: string; category: ErrorCategory; status: number; title: string; suggestion?: string; /** Process exit code to use when this error reaches the CLI boundary. */ exitCode?: number; } /** * Options for creating an error instance */ export interface ErrorCreateOptions { /** Override the error message (defaults to detail or definition title) */ message?: string; detail?: string; cause?: unknown; instance?: string; context?: unknown; /** Override the definition's default HTTP status (e.g., for per-request status codes) */ status?: number; } /** * Registered error with factory method */ export interface RegisteredError { readonly slug: string; readonly category: ErrorCategory; readonly status: number; readonly title: string; readonly suggestion?: string; readonly exitCode?: number; readonly create: (options?: ErrorCreateOptions) => VeryfrontError; } /** * Define an error in the registry */ export declare function defineError(definition: ErrorDefinition): RegisteredError; /** * Options for VeryfrontError constructor */ export interface VeryfrontErrorOptions extends ErrorCreateOptions { slug: string; category: ErrorCategory; status: number; title: string; suggestion?: string; /** Process exit code to use at the CLI boundary. */ exitCode?: number; } /** Data-only snapshot used at logging, HTTP, CLI, and telemetry boundaries. */ export interface VeryfrontErrorSnapshot { readonly slug: string; readonly category: ErrorCategory; readonly status: number; readonly title: string; readonly message: string; readonly suggestion?: string; readonly exitCode?: number; readonly detail?: string; readonly cause?: unknown; readonly instance?: string; readonly context?: unknown; readonly stack?: string; } /** * Veryfront Error class with slug-based error identity */ export declare class VeryfrontError extends Error { slug: string; category: ErrorCategory; status: number; title: string; suggestion?: string; /** Process exit code for the CLI boundary. */ exitCode?: number; detail?: string; cause?: unknown; instance?: string; context?: unknown; constructor(message: string, options: VeryfrontErrorOptions); /** * Convert to RFC 9457 Problem Details format */ toRFC9457(): RFC9457Response; /** * Get documentation URL for this error */ getDocsUrl(): string; } /** Runtime-safe VeryfrontError guard for values caught from untrusted code. */ export declare function isVeryfrontErrorInstance(error: unknown): error is VeryfrontError; /** * Read a VeryfrontError once into plain data. * * A proxy can pass `instanceof VeryfrontError` and still throw from any field * getter. Boundary code must use this snapshot instead of repeatedly reading * the original object. */ export declare function snapshotVeryfrontError(error: unknown): VeryfrontErrorSnapshot | null; /** * Snapshot a value that has already been classified as a VeryfrontError. * * Keeping classification separate lets boundary code avoid a second * `instanceof`/proxy-prototype inspection after it has committed to this * branch. */ export declare function snapshotKnownVeryfrontError(error: VeryfrontError): VeryfrontErrorSnapshot | null; //# sourceMappingURL=types.d.ts.map