/** * Common AWS error types that might need special handling */ export declare enum AwsErrorType { ACCESS_DENIED = "AccessDeniedException", RESOURCE_NOT_FOUND = "ResourceNotFoundException", VALIDATION_ERROR = "ValidationException", LIMIT_EXCEEDED = "LimitExceededException", THROTTLING = "ThrottlingException", SERVICE_UNAVAILABLE = "ServiceUnavailableException", REQUEST_TIMEOUT = "RequestTimeoutException", NETWORK_ERROR = "NetworkingError", CREDENTIALS_ERROR = "CredentialsError" } /** * HTTP Status codes for different error types */ export declare enum HttpStatusCode { BAD_REQUEST = 400, UNAUTHORIZED = 401, FORBIDDEN = 403, NOT_FOUND = 404, CONFLICT = 409, TOO_MANY_REQUESTS = 429, INTERNAL_SERVER_ERROR = 500, SERVICE_UNAVAILABLE = 503 } /** * Base error class for all application errors */ export declare class BaseError extends Error { readonly statusCode: HttpStatusCode; readonly isOperational: boolean; readonly errorCode: string; readonly originalError?: (Error | unknown) | undefined; constructor(message: string, statusCode?: HttpStatusCode, isOperational?: boolean, errorCode?: string, originalError?: (Error | unknown) | undefined); /** * Returns a sanitized version of the error for client responses */ toClientResponse(): Record; } /** * Custom error class for AWS service errors */ export declare class AwsServiceError extends BaseError { readonly serviceName: string; readonly operation: string; constructor(message: string, serviceName: string, operation: string, originalError?: Error | unknown, statusCode?: HttpStatusCode); readonly awsRequestId?: string; readonly awsErrorType?: string; readonly awsStatusCode?: number; /** * Returns a detailed representation of the error */ toDetailedString(): string; /** * Returns a sanitized version of the error for client responses */ toClientResponse(): Record; } /** * Custom error class for configuration errors */ export declare class ConfigurationError extends BaseError { constructor(message: string, configKey?: string, originalError?: Error | unknown); readonly configKey?: string; /** * Returns a sanitized version of the error for client responses */ toClientResponse(): Record; } /** * Custom error class for tool execution errors */ export declare class ToolExecutionError extends BaseError { readonly toolName: string; readonly toolParams?: Record | undefined; constructor(message: string, toolName: string, toolParams?: Record | undefined, originalError?: Error | unknown, statusCode?: HttpStatusCode); /** * Returns a sanitized version of the error for client responses */ toClientResponse(): Record; } /** * Custom error class for transport errors */ export declare class TransportError extends BaseError { readonly sessionId: string; constructor(message: string, sessionId: string, originalError?: Error | unknown, statusCode?: HttpStatusCode); /** * Returns a sanitized version of the error for client responses */ toClientResponse(): Record; } /** * Custom error class for validation errors */ export declare class ValidationError extends BaseError { readonly validationErrors: Record[]; constructor(message: string, validationErrors: Record[], originalError?: Error | unknown); /** * Returns a sanitized version of the error for client responses */ toClientResponse(): Record; } /** * Wrap an AWS error with additional context * @param error The original error * @param serviceName The AWS service name * @param operation The operation being performed * @returns A wrapped AwsServiceError */ export declare function wrapAwsError(error: unknown, serviceName: string, operation: string): AwsServiceError; /** * Format an error for client response * @param error The error to format * @returns A formatted error response object */ export declare function formatErrorForClient(error: unknown): Record; /** * Determine if an error is operational (expected) or programming (unexpected) * @param error The error to check * @returns Whether the error is operational */ export declare function isOperationalError(error: unknown): boolean; /** * Handles AWS errors and transforms them into appropriate application errors * @param error Original error from AWS SDK * @param serviceName AWS service name (e.g., 'CloudWatchLogs') * @param operation Operation being performed * @returns Properly wrapped and contextualized error */ export declare function handleAwsError(error: any, serviceName: string, operation: string): Error; /** * Safely gets error status code handling common edge cases * @param error Error object * @returns HTTP status code */ export declare function getErrorStatusCode(error: unknown): HttpStatusCode;