/** * FlashQ Error Classes * * Specific error types for better error handling and programmatic responses. */ /** Base error class for all FlashQ errors */ export declare class FlashQError extends Error { readonly code: string; readonly retryable: boolean; constructor(message: string, code: string, retryable?: boolean); } /** Connection-related errors */ export declare class ConnectionError extends FlashQError { constructor(message: string, code?: ConnectionErrorCode); } export type ConnectionErrorCode = 'CONNECTION_FAILED' | 'CONNECTION_TIMEOUT' | 'CONNECTION_CLOSED' | 'RECONNECTION_FAILED' | 'NOT_CONNECTED' | 'QUEUE_FULL'; /** Authentication errors */ export declare class AuthenticationError extends FlashQError { constructor(message?: string); } /** Request timeout errors */ export declare class TimeoutError extends FlashQError { readonly timeoutMs: number; constructor(message: string, timeoutMs: number); } /** Validation errors (client-side) */ export declare class ValidationError extends FlashQError { readonly field?: string; constructor(message: string, field?: string); } /** Server-side errors */ export declare class ServerError extends FlashQError { readonly serverCode?: string; constructor(message: string, serverCode?: string); } /** Job not found */ export declare class JobNotFoundError extends FlashQError { readonly jobId: number | string; constructor(jobId: number | string); } /** Queue not found */ export declare class QueueNotFoundError extends FlashQError { readonly queue: string; constructor(queue: string); } /** Job already exists (duplicate) */ export declare class DuplicateJobError extends FlashQError { readonly existingJobId?: number; constructor(message: string, existingJobId?: number); } /** Queue is paused */ export declare class QueuePausedError extends FlashQError { readonly queue: string; constructor(queue: string); } /** Rate limit exceeded */ export declare class RateLimitError extends FlashQError { readonly queue: string; readonly retryAfterMs?: number; constructor(queue: string, retryAfterMs?: number); } /** Concurrency limit exceeded */ export declare class ConcurrencyLimitError extends FlashQError { readonly queue: string; constructor(queue: string); } /** Parse server error message and return appropriate error class */ export declare function parseServerError(message: string, serverCode?: string): FlashQError; /** Batch operation partial failure */ export declare class BatchError extends FlashQError { /** Successfully processed items */ readonly succeeded: T[]; /** Failed items with their errors */ readonly failed: Array<{ index: number; item: unknown; error: Error; }>; constructor(message: string, succeeded: T[], failed: Array<{ index: number; item: unknown; error: Error; }>); /** Get number of successful items */ get successCount(): number; /** Get number of failed items */ get failureCount(): number; } /** All error types exported for instanceof checks */ export declare const Errors: { FlashQError: typeof FlashQError; ConnectionError: typeof ConnectionError; AuthenticationError: typeof AuthenticationError; TimeoutError: typeof TimeoutError; ValidationError: typeof ValidationError; ServerError: typeof ServerError; JobNotFoundError: typeof JobNotFoundError; QueueNotFoundError: typeof QueueNotFoundError; DuplicateJobError: typeof DuplicateJobError; QueuePausedError: typeof QueuePausedError; RateLimitError: typeof RateLimitError; ConcurrencyLimitError: typeof ConcurrencyLimitError; BatchError: typeof BatchError; }; //# sourceMappingURL=errors.d.ts.map