/** * # Centralized Error Service * * Provides centralized error handling, logging, and user-friendly message generation * across the entire application. This service standardizes error handling patterns * and provides consistent error reporting. * * ## Business Perspective * Ensures consistent error handling and reporting across the application, improving * user experience by providing clear, actionable error messages and enabling better * debugging through centralized logging. Critical for operational excellence. 🛡️ * * ## Technical Perspective * Implements centralized error logging, user-friendly message generation, and * error recovery detection. Integrates with existing logger and error types. * * @packageDocumentation */ import { ErrorContext } from './errors'; /** * Error severity levels for categorization */ export declare enum ErrorSeverity { /** Low severity - informational errors */ LOW = "low", /** Medium severity - user action may be needed */ MEDIUM = "medium", /** High severity - significant functionality impacted */ HIGH = "high", /** Critical severity - application-wide impact */ CRITICAL = "critical" } /** * Error log entry structure */ export interface ErrorLogEntry { /** Error message */ message: string; /** Error severity */ severity: ErrorSeverity; /** Error context */ context?: ErrorContext; /** Error stack trace */ stack?: string; /** Timestamp */ timestamp: string; /** User-friendly message */ userMessage: string; /** Whether the error is recoverable */ recoverable: boolean; } /** * Centralized Error Service * * Provides consistent error handling, logging, and user-friendly message generation * across the entire application. * * @example * ```typescript * // Log an error with context * errorService.logError( * new Error('Data fetch failed'), * { service: 'ComplianceService', method: 'fetchData' } * ); * * // Get user-friendly message * const message = errorService.getUserFriendlyMessage(error); * * // Check if error is recoverable * const canRetry = errorService.canRecover(error); * ``` */ export declare class ErrorService { private static instance; /** * Get the singleton instance */ static getInstance(): ErrorService; /** * Private constructor for singleton pattern */ private constructor(); /** * Log an error with context * * @param error - Error to log * @param context - Optional error context * @param severity - Error severity level */ logError(error: Error, context?: ErrorContext, severity?: ErrorSeverity): void; /** * Get a user-friendly error message * * @param error - Error to convert to user-friendly message * @returns User-friendly error message */ getUserFriendlyMessage(error: unknown): string; /** * Check if an error can be recovered from * * @param error - Error to check * @returns True if the error is recoverable */ canRecover(error: unknown): boolean; /** * Get error severity based on error type * * @param error - Error to analyze * @returns Error severity level */ getErrorSeverity(error: unknown): ErrorSeverity; /** * Create a formatted error message for display * * @param error - Error to format * @param includeDetails - Whether to include technical details * @returns Formatted error message */ formatErrorForDisplay(error: unknown, includeDetails?: boolean): string; } /** * Export singleton instance for convenient access */ export declare const errorService: ErrorService; /** * Export default instance */ export default errorService; //# sourceMappingURL=errorService.d.ts.map