export declare class HttpError extends Error { readonly status: number; readonly details?: unknown; constructor(status: number, message: string, details?: unknown); toJSON(): { details?: {} | null | undefined; error: string; status: number; }; } export declare const errors: { badRequest: (message?: string, details?: unknown) => HttpError; unauthorized: (message?: string, details?: unknown) => HttpError; forbidden: (message?: string, details?: unknown) => HttpError; notFound: (message?: string, details?: unknown) => HttpError; conflict: (message?: string, details?: unknown) => HttpError; unprocessable: (message?: string, details?: unknown) => HttpError; internal: (message?: string, details?: unknown) => HttpError; serviceUnavailable: (message?: string, details?: unknown) => HttpError; }; /** * Map common Postgres SQLSTATE codes to a sensible HTTP status + structured * body. Returns `null` if the error doesn't carry a recognised pg code. * * - 23505 unique_violation → 409 Conflict * - 23503 foreign_key_violation → 422 Unprocessable Entity * - 23502 not_null_violation → 400 Bad Request * - 23514 check_violation → 400 Bad Request */ export declare function pgErrorToHttpError(err: unknown): HttpError | null; /** * Map @mathislair/mtbdb's ConnectionError (duck-typed by name + reason) to an * HTTP status. Reaches mtbrest when a route runs against a Connection whose * pool died mid-request, or in lazy connect modes. */ export declare function connectionErrorToHttpError(err: unknown): HttpError | null; //# sourceMappingURL=errors.d.ts.map