@thalorlabs/errors
Version:
Enhanced exception handling system for TypeScript applications with comprehensive error classes and debugging capabilities
28 lines (27 loc) • 1.01 kB
TypeScript
import CustomError from './CustomError';
/**
* Error for quota exceeded scenarios with usage information.
*
* Used when resource quotas are exceeded with specific usage and reset timing data.
* Provides structured quota information for API responses with HTTP 429 status.
*
* @example
* throw new QuotaExceededError(
* 'API quota exceeded',
* 'requests', // quotaType
* 1000, // currentUsage
* 1000, // maxQuota
* new Date(Date.now() + 86400000), // resetTime (24 hours)
* 'req-123'
* );
*
* throw new QuotaExceededError('Storage quota exceeded', 'storage', 5000000000, 5000000000, undefined, 'req-456');
*/
export declare class QuotaExceededError extends CustomError {
quotaType?: string;
currentUsage?: number;
maxQuota?: number;
resetTime?: Date;
constructor(message?: string, quotaType?: string, currentUsage?: number, maxQuota?: number, resetTime?: Date, requestId?: string, context?: Record<string, any>);
getErrorResponse(): Record<string, any>;
}