export interface HttpErrorPayload { code: string; message: string; details?: TErrorDetails; statusCode?: number; expose?: boolean; } /** * Custom HTTP Error class for structured error handling in API responses * @template TErrorDetails - Type for additional error details (can be any type) * @extends Error - Built-in JavaScript Error class * @example * throw new ProcessError({ * code: 'NOT_FOUND', * message: 'User not found', * details: { userId: 123 }, * statusCode: 404 * }); */ export declare class HttpError extends Error { /** Unique error code identifier (e.g., 'VALIDATION_ERROR', 'NOT_FOUND') */ readonly code: string; /** Additional error details with type safety via generics */ readonly details?: TErrorDetails; /** HTTP status code (e.g., 404, 500, 401) */ readonly statusCode: number; /** Whether to expose error details to the client (use false for sensitive errors) */ readonly expose: boolean; /** * Creates a new ProcessError instance * @param payload - Error configuration object containing all error properties */ constructor(payload: HttpErrorPayload); /** * Generates the error payload for HTTP responses * @param withDetails - Whether to include error details in the payload (default: false) * @returns An object containing the error code, message, and optionally details */ statusPayload(withDetails?: boolean): { code: string; message: string; details: TErrorDetails | undefined; }; } /** * Type guard to check if an error is an instance of ProcessError */ export declare const isHttpError: (error: unknown) => error is HttpError;