ai-debug-local-mcp
Version:
🎯 ENHANCED AI GUIDANCE v4.1.2: Dramatically improved tool descriptions help AI users choose the right tools instead of 'close enough' options. Ultra-fast keyboard automation (10x speed), universal recording, multi-ecosystem debugging support, and compreh
121 lines • 3.68 kB
TypeScript
/**
* Centralized Error Handling for AI Debug Local MCP
*
* Provides consistent error handling across the entire codebase with:
* - Custom error classes for different error types
* - Error codes for programmatic handling
* - Structured error responses
* - Retry logic determination
* - User-friendly error formatting
*
* This replaces the 563 scattered throw statements with a consistent pattern.
*/
export declare enum ErrorCode {
UNKNOWN = "UNKNOWN",
PROCESSING_ERROR = "PROCESSING_ERROR",
TIMEOUT_ERROR = "TIMEOUT_ERROR",
PERMISSION_ERROR = "PERMISSION_ERROR",
SESSION_NOT_FOUND = "SESSION_NOT_FOUND",
SESSION_EXPIRED = "SESSION_EXPIRED",
FRAMEWORK_MISMATCH = "FRAMEWORK_MISMATCH",
FRAMEWORK_NOT_DETECTED = "FRAMEWORK_NOT_DETECTED",
TOOL_NOT_FOUND = "TOOL_NOT_FOUND",
TOOL_EXECUTION_ERROR = "TOOL_EXECUTION_ERROR",
BROWSER_ERROR = "BROWSER_ERROR",
BROWSER_LAUNCH_FAILED = "BROWSER_LAUNCH_FAILED",
BROWSER_NAVIGATION_FAILED = "BROWSER_NAVIGATION_FAILED",
NETWORK_ERROR = "NETWORK_ERROR",
NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
VALIDATION_ERROR = "VALIDATION_ERROR",
INVALID_ARGUMENTS = "INVALID_ARGUMENTS",
CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
MISSING_API_KEY = "MISSING_API_KEY"
}
/**
* Base error class for all AI Debug errors
*/
export declare class AIDebugError extends Error {
readonly code: ErrorCode;
readonly timestamp: Date;
readonly context?: Record<string, any>;
constructor(message: string, code?: ErrorCode, context?: Record<string, any>);
}
/**
* Session-related errors
*/
export declare class SessionNotFoundError extends AIDebugError {
readonly sessionId: string;
constructor(sessionId: string);
}
/**
* Framework mismatch errors
*/
export declare class FrameworkMismatchError extends AIDebugError {
readonly expected: string;
readonly actual: string;
constructor(expected: string, actual: string);
}
/**
* Tool not found errors
*/
export declare class ToolNotFoundError extends AIDebugError {
readonly toolName: string;
constructor(toolName: string);
}
/**
* Browser-related errors
*/
export declare class BrowserError extends AIDebugError {
readonly cause?: Error;
constructor(message: string, cause?: Error, context?: Record<string, any>);
}
/**
* Network-related errors
*/
export declare class NetworkError extends AIDebugError {
readonly statusCode?: number;
readonly url?: string;
constructor(message: string, statusCode?: number, url?: string);
}
/**
* Validation errors
*/
export declare class ValidationError extends AIDebugError {
readonly field?: string;
readonly expectedType?: string;
constructor(message: string, field?: string, expectedType?: string);
}
/**
* Configuration errors
*/
export declare class ConfigurationError extends AIDebugError {
readonly configKey?: string;
constructor(message: string, configKey?: string);
}
/**
* Error handler utility functions
*/
export declare const errorHandler: {
/**
* Handle an error and return a structured response
*/
handle(error: unknown, logger?: any): {
error: boolean;
code: ErrorCode;
message: string;
details: Record<string, any>;
};
/**
* Wrap an existing error with additional context
*/
wrap(error: Error, message: string, code?: ErrorCode, context?: Record<string, any>): AIDebugError;
/**
* Check if an error is retryable
*/
isRetryable(error: unknown): boolean;
/**
* Format error for user display
*/
formatForUser(error: unknown): string;
};
//# sourceMappingURL=error-handler.d.ts.map