pms-analysis-reports-mcp-server
Version:
PMS analysis reports server handling maintenance reports, equipment analysis, compliance tracking, and performance metrics with ERP access for data extraction
38 lines (37 loc) • 1.56 kB
TypeScript
export interface ErrorContext {
toolName?: string;
arguments?: any;
userId?: string;
timestamp?: Date;
requestId?: string;
}
export interface StandardError {
code: string;
message: string;
details?: any;
timestamp: Date;
requestId?: string;
}
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"
}
export declare class ErrorHandler {
static handleError(error: any, context?: ErrorContext): StandardError;
private static categorizeError;
static handleValidationError(errors: any[], context?: ErrorContext): StandardError;
static handleDatabaseError(error: any, operation: string, context?: ErrorContext): StandardError;
static handleExternalAPIError(error: any, apiName: string, context?: ErrorContext): StandardError;
private static generateRequestId;
static createToolErrorResponse(error: any, toolName: string, args?: any): any;
static safeExecute<T>(operation: () => Promise<T>, fallbackValue: T, context?: ErrorContext): Promise<T>;
static executeWithRetry<T>(operation: () => Promise<T>, maxRetries?: number, delayMs?: number, context?: ErrorContext): Promise<T>;
}