UNPKG

defect-inspection-tools-mcp-server

Version:

Defect inspection tools server handling defect detection, analysis, and reporting with AI/ML capabilities for quality control

54 lines (53 loc) 2.21 kB
export declare enum ErrorCodes { VALIDATION_ERROR = "VALIDATION_ERROR", AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR", AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR", RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND", DATABASE_ERROR = "DATABASE_ERROR", EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR", RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED", INTERNAL_ERROR = "INTERNAL_ERROR", INVALID_INPUT = "INVALID_INPUT", TIMEOUT_ERROR = "TIMEOUT_ERROR", TYPESENSE_ERROR = "TYPESENSE_ERROR", MARITIME_VALIDATION_ERROR = "MARITIME_VALIDATION_ERROR" } export interface ErrorContext { toolName: string; arguments: any; userId?: string; timestamp: Date; requestId: string; } export interface StandardError { code: ErrorCodes; message: string; details?: any; timestamp: Date; requestId: string; } export declare class ErrorHandler { private static readonly MAX_RETRIES; private static readonly RETRY_DELAY_MS; private static readonly TIMEOUT_MS; static handleError(error: any, context: ErrorContext): StandardError; private static classifyError; private static isDatabaseError; private static isTypesenseError; private static isValidationError; private static isExternalApiError; private static isTimeoutError; private static isMaritimeValidationError; private static isAuthenticationError; private static isAuthorizationError; private static isResourceNotFoundError; private static isRateLimitError; private static createFallbackError; static safeExecute<T>(fn: () => Promise<T>, fallbackValue: T, context: ErrorContext): Promise<T>; static executeWithRetry<T>(fn: () => Promise<T>, context: ErrorContext, maxRetries?: number, delay?: number): Promise<T>; static executeWithTimeout<T>(fn: () => Promise<T>, timeout: number | undefined, context: ErrorContext): Promise<T>; static generateRequestId(): string; static createErrorContext(toolName: string, arguments_: any, userId?: string, requestId?: string): ErrorContext; static formatErrorForToolResponse(error: StandardError): any; static formatErrorForLogging(error: any, context: ErrorContext): any; }