Download libs/utils/dist/error-handler.d.ts from Leon4gr45/automaker: direct link, hf CLI and curl.
- Browser
- Download file 4.12 kB
-
https://huggingface.co/spaces/Leon4gr45/automaker/resolve/main/libs/utils/dist/error-handler.d.ts
- Command line
-
hf download hf://spaces/Leon4gr45/automaker/libs/utils/dist/error-handler.d.ts
-
curl -L -o error-handler.d.ts https://huggingface.co/spaces/Leon4gr45/automaker/resolve/main/libs/utils/dist/error-handler.d.ts
4.12 kB
| /** | |
| * Error handling utilities for standardized error classification | |
| * | |
| * Provides utilities for: | |
| * - Detecting abort/cancellation errors | |
| * - Detecting authentication errors | |
| * - Detecting rate limit and quota exhaustion errors | |
| * - Classifying errors by type | |
| * - Generating user-friendly error messages | |
| */ | |
| import type { ErrorInfo } from '@automaker/types'; | |
| /** | |
| * Check if an error is an abort/cancellation error | |
| * | |
| * @param error - The error to check | |
| * @returns True if the error is an abort error | |
| */ | |
| export declare function isAbortError(error: unknown): boolean; | |
| /** | |
| * Check if an error is a user-initiated cancellation | |
| * | |
| * @param errorMessage - The error message to check | |
| * @returns True if the error is a user-initiated cancellation | |
| */ | |
| export declare function isCancellationError(errorMessage: string): boolean; | |
| /** | |
| * Check if an error is an authentication/API key error | |
| * | |
| * @param errorMessage - The error message to check | |
| * @returns True if the error is authentication-related | |
| */ | |
| export declare function isAuthenticationError(errorMessage: string): boolean; | |
| /** | |
| * Check if an error is a rate limit error (429 Too Many Requests) | |
| * | |
| * @param error - The error to check | |
| * @returns True if the error is a rate limit error | |
| */ | |
| export declare function isRateLimitError(error: unknown): boolean; | |
| /** | |
| * Check if an error indicates quota/usage exhaustion | |
| * This includes session limits, weekly limits, credit/billing issues, and overloaded errors | |
| * | |
| * @param error - The error to check | |
| * @returns True if the error indicates quota exhaustion | |
| */ | |
| export declare function isQuotaExhaustedError(error: unknown): boolean; | |
| /** | |
| * Check if an error indicates a model-not-found or model access issue | |
| * | |
| * @param error - The error to check | |
| * @returns True if the error indicates the model doesn't exist or user lacks access | |
| */ | |
| export declare function isModelNotFoundError(error: unknown): boolean; | |
| /** | |
| * Check if an error indicates a stream disconnection | |
| * | |
| * @param error - The error to check | |
| * @returns True if the error indicates the stream was disconnected | |
| */ | |
| export declare function isStreamDisconnectedError(error: unknown): boolean; | |
| /** | |
| * Extract retry-after duration from rate limit error | |
| * | |
| * @param error - The error to extract retry-after from | |
| * @returns Number of seconds to wait, or undefined if not found | |
| */ | |
| export declare function extractRetryAfter(error: unknown): number | undefined; | |
| /** | |
| * Classify an error into a specific type | |
| * | |
| * @param error - The error to classify | |
| * @returns Classified error information | |
| */ | |
| export declare function classifyError(error: unknown): ErrorInfo; | |
| /** | |
| * Get a user-friendly error message | |
| * | |
| * @param error - The error to convert | |
| * @returns User-friendly error message | |
| */ | |
| export declare function getUserFriendlyErrorMessage(error: unknown): string; | |
| /** | |
| * Extract error message from an unknown error value | |
| * | |
| * Simple utility for getting a string error message from any error type. | |
| * Returns the error's message property if it's an Error, otherwise | |
| * converts to string. Used throughout the codebase for consistent | |
| * error message extraction. | |
| * | |
| * @param error - The error value (Error object, string, or unknown) | |
| * @returns Error message string | |
| * | |
| * @example | |
| * ```typescript | |
| * try { | |
| * throw new Error("Something went wrong"); | |
| * } catch (error) { | |
| * const message = getErrorMessage(error); // "Something went wrong" | |
| * } | |
| * ``` | |
| */ | |
| export declare function getErrorMessage(error: unknown): string; | |
| /** | |
| * Log an error with a context message to stderr. | |
| * | |
| * Convenience utility for consistent error logging throughout the codebase. | |
| * Outputs a formatted error line to stderr with an ❌ prefix and the context. | |
| * | |
| * @param error - The error value to log | |
| * @param context - Descriptive context message indicating where/why the error occurred | |
| * | |
| * @example | |
| * ```typescript | |
| * try { | |
| * await someOperation(); | |
| * } catch (error) { | |
| * logError(error, 'Failed to perform some operation'); | |
| * } | |
| * ``` | |
| */ | |
| export declare function logError(error: unknown, context: string): void; | |
| //# sourceMappingURL=error-handler.d.ts.map |