Home > @opengovsg/rate-limit > RateLimitExceededError
RateLimitExceededError class
Thrown when a key has exhausted its rate-limit allowance.
Carries everything needed to build an HTTP 429 response. See RateLimitExceededError.toHttpHeaders() for deriving a Retry-After header value.
Signature:
typescript
export declare class RateLimitExceededError extends ErrorExtends: Error
Constructors
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(info) | Constructs a new instance of the RateLimitExceededError class |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| info | readonly | RateLimitInfo | Rate-limit state at the time of rejection. |
Methods
| Method | Modifiers | Description |
|---|---|---|
| toHttpHeaders() | Derive the Retry-After HTTP 429 response header from this rejection. |