Class: RateLimitError
Defined in: src/types/errors.ts:325
Rate limit exceeded error.
Remarks
Thrown when a client exceeds the allowed request rate for an endpoint.
HTTP mapping: 429 Too Many Requests
Example
if (requestCount > limit) {
throw new RateLimitError(60); // Retry after 60 seconds
}
Extends
Constructors
new RateLimitError()
new RateLimitError(
retryAfter):RateLimitError
Defined in: src/types/errors.ts:342
Creates a new RateLimitError.
Parameters
retryAfter
number
Seconds to wait before retrying
Returns
Overrides
Properties
cause?
readonlyoptionalcause:Error
Defined in: src/types/errors.ts:71
Original error that caused this error (if any).
Remarks
Error chaining allows tracking the full error context through multiple layers of the application. Useful for debugging complex error scenarios.
Example
try {
await fetchData();
} catch (err) {
throw new ValidationError('Failed to validate data', 'field', 'required', err as Error);
}
Inherited from
code
readonlycode:"RATE_LIMIT_EXCEEDED"='RATE_LIMIT_EXCEEDED'
Defined in: src/types/errors.ts:326
Machine-readable error code.
Remarks
Error codes are unique identifiers for error types, enabling programmatic error handling (switch statements, error maps), error tracking in monitoring systems, and client-side error translation (i18n).
Overrides
retryAfter
readonlyretryAfter:number
Defined in: src/types/errors.ts:335
Seconds to wait before retrying.
Remarks
Clients should respect this value and implement exponential backoff for repeated rate limit errors.