Skip to content

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 Error

Extends: Error

Constructors ​

ConstructorModifiersDescription
(constructor)(info)Constructs a new instance of the RateLimitExceededError class

Properties ​

PropertyModifiersTypeDescription
inforeadonlyRateLimitInfoRate-limit state at the time of rejection.

Methods ​

MethodModifiersDescription
toHttpHeaders()Derive the Retry-After HTTP 429 response header from this rejection.