/** * Centralized error handling utilities for consistent error processing * Preserves stack traces and provides user-friendly messages */ /** * Error categories for better error handling */ export declare enum ErrorCategory { USER_ERROR = "USER_ERROR",// User input issues SYSTEM_ERROR = "SYSTEM_ERROR",// Internal system failures NETWORK_ERROR = "NETWORK_ERROR",// API/network issues AUTH_ERROR = "AUTH_ERROR",// Authentication/authorization VALIDATION_ERROR = "VALIDATION_ERROR" } /** * Structured error information */ export interface ErrorInfo { message: string; category: ErrorCategory; code?: string; details?: Record; stack?: string; originalError?: Error; } /** * Custom error class with additional context */ export declare class ApplicationError extends Error { readonly category: ErrorCategory; readonly code?: string; readonly details?: Record; readonly originalError?: Error; constructor(message: string, category?: ErrorCategory, code?: string, details?: Record, originalError?: Error); } /** * Error thrown when an element is not found. * * Used by strategies and handlers when a requested element does not exist. * This error is caught by MCPAQLHandler and converted to a proper failure response. * * @see Issue #275 - Handlers return success=true for missing elements */ export declare class ElementNotFoundError extends ApplicationError { readonly elementType: string; readonly elementName: string; constructor(elementType: string, elementName: string); } /** * Error thrown when a required parameter is missing. * * Used by handlers when an operation requires a parameter that was not provided. * * @see Issue #275 - Handlers return success=true for missing elements */ export declare class MissingParameterError extends ApplicationError { readonly parameterName: string; readonly operation: string; constructor(parameterName: string, operation: string); } /** * Utility class for consistent error handling */ export declare class ErrorHandler { /** * Maximum stack trace depth to prevent memory issues */ private static readonly MAX_STACK_DEPTH; /** * Maximum length for stack trace strings */ private static readonly MAX_STACK_LENGTH; /** * Truncate stack trace to prevent memory issues */ static truncateStack(stack?: string): string | undefined; /** * Extract error information while preserving context */ static extractErrorInfo(error: unknown): ErrorInfo; /** * Get user-friendly error message */ static getUserMessage(error: unknown): string; /** * Log error with appropriate level and context */ static logError(context: string, error: unknown, additionalInfo?: Record): void; /** * Create an error with context preservation */ static createError(message: string, category?: ErrorCategory, code?: string, originalError?: unknown): ApplicationError; /** * Wrap an error with additional context */ static wrapError(error: unknown, context: string, category?: ErrorCategory): ApplicationError; /** * Check if error is of a specific category */ static isErrorCategory(error: unknown, category: ErrorCategory): boolean; /** * Format error for API response */ static formatForResponse(error: unknown): { success: false; message: string; error: string; details?: Record; }; } //# sourceMappingURL=ErrorHandler.d.ts.map