azureai-optimizer
Version:
AI-Powered Azure Infrastructure Optimization via Model Context Protocol
69 lines • 2.85 kB
TypeScript
/**
* Error Handling Utilities
* Standardized error types and handling for MCP operations
*/
export declare enum ErrorCode {
PARSE_ERROR = -32700,
INVALID_REQUEST = -32600,
METHOD_NOT_FOUND = -32601,
INVALID_PARAMS = -32602,
INTERNAL_ERROR = -32603,
UNAUTHORIZED = -32000,
FORBIDDEN = -32001,
NOT_FOUND = -32002,
TIMEOUT = -32003,
RATE_LIMITED = -32004,
SERVICE_UNAVAILABLE = -32005,
AZURE_AUTH_FAILED = -33000,
AZURE_SUBSCRIPTION_NOT_FOUND = -33001,
AZURE_PERMISSION_DENIED = -33002,
AZURE_API_ERROR = -33003,
AZURE_QUOTA_EXCEEDED = -33004,
TOOL_EXECUTION_FAILED = -34000,
TOOL_NOT_FOUND = -34001,
TOOL_CONFIGURATION_ERROR = -34002,
AI_PROVIDER_ERROR = -34003,
DATA_VALIDATION_ERROR = -34004
}
export declare class MCPError extends Error {
readonly code: ErrorCode;
readonly data?: any;
constructor(code: ErrorCode, message: string, data?: any);
toJSON(): any;
static fromError(error: any, code?: ErrorCode): MCPError;
static isRetryable(error: MCPError): boolean;
}
export declare class AzureError extends MCPError {
readonly azureErrorCode?: string;
readonly requestId?: string;
constructor(code: ErrorCode, message: string, azureErrorCode?: string, requestId?: string, data?: any);
static fromAzureResponse(response: any): AzureError;
}
export declare class ToolError extends MCPError {
readonly toolName: string;
readonly executionContext?: any;
constructor(toolName: string, code: ErrorCode, message: string, executionContext?: any, data?: any);
static toolNotFound(toolName: string): ToolError;
static executionFailed(toolName: string, error: any, context?: any): ToolError;
static configurationError(toolName: string, message: string): ToolError;
}
export declare class ValidationError extends MCPError {
readonly field?: string;
readonly value?: any;
constructor(message: string, field?: string, value?: any);
static required(field: string): ValidationError;
static invalid(field: string, value: any, reason?: string): ValidationError;
static type(field: string, expectedType: string, actualType: string): ValidationError;
}
export declare class AIProviderError extends MCPError {
readonly provider: string;
readonly originalError?: any;
constructor(provider: string, message: string, originalError?: any);
static notConfigured(provider: string): AIProviderError;
static apiError(provider: string, error: any): AIProviderError;
static quotaExceeded(provider: string): AIProviderError;
}
export declare function handleError(error: any): MCPError;
export declare function isRetryableError(error: any): boolean;
export declare function getErrorSeverity(error: MCPError): 'low' | 'medium' | 'high' | 'critical';
//# sourceMappingURL=errors.d.ts.map