jsm-exceptions
Version:
A comprehensive TypeScript exception library with HTTP status code support, detailed JSDoc documentation, and backward compatibility. Provides structured error handling for web applications and APIs.
33 lines (32 loc) • 1.02 kB
TypeScript
import BaseException from "./base.exception";
/**
* @fileoverview Too Many Requests exception (HTTP 429)
* @author dr. Salmi <reevosolutions@gmail.com>
*/
/**
* Exception thrown when rate limiting is triggered.
* Corresponds to HTTP 429 Too Many Requests status code.
*
* @class TooManyRequestsException
* @extends {BaseException}
* @example
* ```typescript
* throw new TooManyRequestsException('Rate limit exceeded');
* throw new TooManyRequestsException('Too many requests', {
* limit: 100,
* windowMs: 60000,
* retryAfter: 30
* });
* ```
*/
declare class TooManyRequestsException extends BaseException {
/**
* Creates an instance of TooManyRequestsException.
*
* @param {string} [message='Too Many Requests'] - The error message
* @param {Record<string, any>} [context] - Additional context about the rate limit
* @memberof TooManyRequestsException
*/
constructor(message?: string, context?: Record<string, any>);
}
export default TooManyRequestsException;