@kimsungwhee/apple-docs-mcp
Version:
MCP server for Apple Developer Documentation - Search iOS/macOS/SwiftUI/UIKit docs, WWDC videos, Swift/Objective-C APIs & code examples in Claude, Cursor & AI assistants
64 lines • 2.19 kB
TypeScript
/**
* Unified error handling utilities
*/
import type { AppError, ErrorResponse } from '../types/error.js';
import { ErrorType } from '../types/error.js';
export type { AppError };
export { ErrorType };
/**
* Create a standardized error response
*/
export declare function createErrorResponse(error: AppError): ErrorResponse;
/**
* Handle fetch errors with specific error types
*/
export declare function handleFetchError(error: unknown, url: string): AppError;
/**
* Handle JSON parsing errors
*/
export declare function handleParseError(error: unknown): AppError;
/**
* Validate input parameters
*/
export declare function validateInput(value: string, fieldName: string, minLength?: number): AppError | null;
/**
* Log error for debugging (only in development)
*/
export declare function logError(error: AppError, context?: string): void;
/**
* Handle generic errors and convert them to AppError
*/
export declare function handleGenericError(error: unknown, context: string, fallbackMessage?: string): AppError;
/**
* Create a standardized error response with consistent formatting
*/
export declare function createStandardErrorResponse(error: unknown, operation: string): ErrorResponse;
/**
* Wrap async functions with error handling
*/
export declare function withErrorHandling<T>(operation: () => Promise<T>, context: string, fallbackMessage?: string): Promise<T>;
/**
* Validate multiple input parameters
*/
export declare function validateInputs(validations: Array<{
value: string;
fieldName: string;
minLength?: number;
}>): AppError | null;
/**
* Handle cache-related errors
*/
export declare function handleCacheError(error: unknown, operation: string): AppError;
/**
* Tool-specific error suggestions
*/
export declare const TOOL_ERROR_SUGGESTIONS: Record<string, Record<string, string[]>>;
/**
* Get tool-specific error suggestions
*/
export declare function getToolErrorSuggestions(toolName: string, errorType: ErrorType): string[];
/**
* Create error response with tool-specific suggestions
*/
export declare function createToolErrorResponse(error: AppError, toolName: string): ErrorResponse;
//# sourceMappingURL=error-handler.d.ts.map