@thalorlabs/errors
Version:
Enhanced exception handling system for TypeScript applications with comprehensive error classes and debugging capabilities
28 lines (27 loc) • 994 B
TypeScript
import CustomError from './CustomError';
/**
* Error for too many requests scenarios with rate limiting information.
*
* Used when request rate limits are exceeded with specific retry timing and usage data.
* Provides structured rate limiting information for API responses with HTTP 429 status.
*
* @example
* throw new TooManyRequestsError(
* 'Rate limit exceeded',
* 60, // retryAfter in seconds
* 100, // limit
* 0, // remaining
* new Date(Date.now() + 60000), // resetTime
* 'req-123'
* );
*
* throw new TooManyRequestsError('Too many requests', 30, undefined, undefined, undefined, 'req-456');
*/
export declare class TooManyRequestsError extends CustomError {
retryAfter?: number;
limit?: number;
remaining?: number;
resetTime?: Date;
constructor(message?: string, retryAfter?: number, limit?: number, remaining?: number, resetTime?: Date, requestId?: string, context?: Record<string, any>);
getErrorResponse(): Record<string, any>;
}