/** * Skillsmith Error Classes - SMI-881 * * Custom error classes with proper cause chaining for better error propagation. * Ensures stack traces and context are preserved through error handling layers. */ /** * Base error class for all Skillsmith errors. * Preserves cause chain and provides structured error information. */ export declare class SkillsmithError extends Error { /** Error code for programmatic handling */ readonly code: string; /** Additional context about the error */ readonly context?: Record; constructor(message: string, options?: { code?: string; cause?: unknown; context?: Record; }); /** * Get the full error chain as an array */ getErrorChain(): Error[]; /** * Format error with full context for logging */ toJSON(): Record; } /** * Network-related errors (fetch failures, timeouts, etc.) */ export declare class NetworkError extends SkillsmithError { constructor(message: string, options?: { cause?: unknown; url?: string; statusCode?: number; context?: Record; }); } /** * API-specific errors (rate limits, auth failures, etc.) * * Note: Rate limit detection includes both 429 (standard) and 403 (GitHub). * GitHub returns 403 Forbidden for rate limit exceeded instead of 429. * See: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api */ export declare class ApiError extends SkillsmithError { /** HTTP status code if applicable */ readonly statusCode?: number; constructor(message: string, options?: { cause?: unknown; statusCode?: number; url?: string; context?: Record; }); /** * Check if this is a rate limit error */ isRateLimitError(): boolean; /** * Check if this is a not found error */ isNotFoundError(): boolean; /** * Check if this is a server error (5xx) */ isServerError(): boolean; } /** * Validation errors (invalid input, schema violations) */ export declare class ValidationError extends SkillsmithError { /** Field that failed validation */ readonly field?: string; constructor(message: string, options?: { cause?: unknown; field?: string; context?: Record; }); } /** * Skill-related errors (not found, invalid structure, etc.) */ export declare class SkillError extends SkillsmithError { /** Skill ID if applicable */ readonly skillId?: string; constructor(message: string, options?: { cause?: unknown; skillId?: string; context?: Record; }); } /** * Configuration errors */ export declare class ConfigurationError extends SkillsmithError { constructor(message: string, options?: { cause?: unknown; context?: Record; }); } /** * Wrap an unknown error in a SkillsmithError if not already one */ export declare function wrapError(error: unknown, message: string, options?: { code?: string; context?: Record; }): SkillsmithError; /** * Extract error message from unknown error */ export declare function getErrorMessage(error: unknown): string; /** * Check if error is a specific type */ export declare function isSkillsmithError(error: unknown): error is SkillsmithError; //# sourceMappingURL=SkillsmithError.d.ts.map