npmplus-mcp-server
Version:
Production-ready MCP server for intelligent JavaScript package management. Works with Claude, Windsurf, Cursor, VS Code, and any MCP-compatible AI editor.
39 lines • 1.34 kB
TypeScript
/**
* Common error handling utilities
*/
export interface ErrorContext {
operation: string;
package?: string;
cwd?: string;
command?: string;
}
/**
* Enhanced error class with context information
*/
export declare class PackageManagerError extends Error {
readonly operation: string;
readonly context?: Partial<ErrorContext>;
readonly originalError?: Error;
constructor(message: string, operation: string, context?: Partial<ErrorContext>, originalError?: Error);
}
/**
* Wraps async operations with consistent error handling
*/
export declare function withErrorHandling<T>(operation: () => Promise<T>, context: ErrorContext): Promise<T>;
/**
* Extracts meaningful error messages from various error types
*/
export declare function extractErrorMessage(error: unknown): string;
/**
* Determines if an error is recoverable and suggests fixes
*/
export declare function getErrorSuggestion(error: unknown): string | null;
/**
* Formats error with context and suggestions
*/
export declare function formatError(error: unknown, context?: Partial<ErrorContext>): string;
/**
* Safely execute a function with error recovery
*/
export declare function safeExecute<T>(operation: () => Promise<T>, fallback: T, onError?: (error: unknown) => void): Promise<T>;
//# sourceMappingURL=error-handling.d.ts.map