RateLimitExceededFilter
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
Defined in: packages/pipeline-rate-limit/src/filters/rate-limit-exceeded.filter.ts:26
Catches RateLimitExceededError thrown by RateLimitBehavior at
the pipeline boundary, mapping it to HTTP 429 Too Many Requests with a
Retry-After header in seconds. It replies through Nest’s HTTP adapter, so it
works on Express and Fastify, also for errors thrown in middleware.
Example
Section titled “Example”Register it globally, so Nest injects the adapter host
@Module({ providers: [{ provide: APP_FILTER, useClass: RateLimitExceededFilter }] })export class AppModule {}Implements
Section titled “Implements”ExceptionFilter
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RateLimitExceededFilter(
adapterHost):RateLimitExceededFilter
Defined in: packages/pipeline-rate-limit/src/filters/rate-limit-exceeded.filter.ts:27
Parameters
Section titled “Parameters”adapterHost
Section titled “adapterHost”HttpAdapterHost
Returns
Section titled “Returns”RateLimitExceededFilter
Methods
Section titled “Methods”catch()
Section titled “catch()”catch(
exception,host):void
Defined in: packages/pipeline-rate-limit/src/filters/rate-limit-exceeded.filter.ts:31
Method to implement a custom exception filter.
Parameters
Section titled “Parameters”exception
Section titled “exception”the class of the exception being handled
ArgumentsHost
used to access an array of arguments for the in-flight request
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”ExceptionFilter.catch