import { IncomingHttpEvent } from './IncomingHttpEvent.js'; import { OutgoingHttpResponse } from './OutgoingHttpResponse.js'; import { ILogger, IErrorHandler } from '@stone-js/core'; /** * HttpErrorHandler options. */ export interface HttpErrorHandlerOptions { logger: ILogger; } /** * Class representing an HttpErrorHandler. */ export declare class HttpErrorHandler implements IErrorHandler { private readonly logger; /** * Create an HttpErrorHandler. * * @param options - HttpErrorHandler options. */ constructor({ logger }: HttpErrorHandlerOptions); /** * Handle an error. * * @param error - The error to handle. * @param event - The incoming http event. * @returns The outgoing http response. */ handle(error: Error, event: IncomingHttpEvent): OutgoingHttpResponse; /** * The status an error declared, when this handler does not know its name. * * A platform-agnostic module cannot import this package, so it says what it means on the error * itself: `AuthorizationError` carries `403`, a limiter's error carries `429`. Keyed only by name, * every one of those answered `500`, which turns a deliberate refusal into a bug report and tells * the caller to retry an operation that was never going to succeed. Honouring the declaration is * what lets a module choose its status without knowing which platform is answering. * * Nothing else changes: an error that declares no usable status is still an internal error, and a * name this handler knows is still matched first. * * @param error - The error, read for a declared status and headers. * @param message - How to render the body for the negotiated type. * @returns The response builder. */ private fromDeclaredStatus; }