/** * HTTP Error Response Utilities * * Provides RFC 9457 (Problem Details for HTTP APIs) compliant error responses. * * @module errors/http-error * @see https://datatracker.ietf.org/doc/html/rfc9457 */ import { type ErrorCategory, type RegisteredError, VeryfrontError } from "./types.js"; /** * Content-Type header for RFC 9457 responses */ export declare const PROBLEM_JSON_CONTENT_TYPE = "application/problem+json"; /** * Create an RFC 9457 compliant error Response */ export declare function createErrorResponse(error: VeryfrontError): Response; /** * Create an RFC 9457 error Response from a registered error definition */ export declare function createErrorResponseFromDefinition(errorDef: RegisteredError, options?: { detail?: string; instance?: string; cause?: string; }): Response; /** * Create an RFC 9457 error Response from raw parameters */ export declare function createProblemResponse(params: { slug: string; title: string; status: number; category: ErrorCategory; detail?: string; instance?: string; suggestion?: string; cause?: string; }): Response; /** * Check if an error is a VeryfrontError with slug-based identity */ export declare function isVeryfrontError(error: unknown): error is VeryfrontError; /** * Convert any error to an RFC 9457 Response * * - If it's a VeryfrontError with slug, serialize directly * - Otherwise, wrap in a generic "unknown-error" response */ export declare function errorToResponse(error: unknown, instance?: string): Response; /** * Express/Hono-style error handler middleware factory * * Usage: * ```typescript * app.onError(createErrorHandler()); * ``` */ export declare function createErrorHandler(): (error: unknown, c: { req: { url: string; }; }) => Response; /** * Log format for errors (matches the plan's log format spec) * * Format: * [ERROR] {slug} ({category}) - {title} * Detail: {detail} * Suggestion: {suggestion} * Docs: https://veryfront.com/docs/code/guides/errors#{slug} */ export declare function formatErrorLog(error: VeryfrontError): string; //# sourceMappingURL=http-error.d.ts.map