Put in order · NestJS course · Module 2: Routing and Request Lifecycle

Scenario: Guard Rejects a Request

Order what happens to a request when a guard rejects it, from the first stage to the last:

Items to put in order

  • Guard - REJECTS request
  • Exception Filter - HANDLES ForbiddenException
  • Middleware - EXECUTED
  • Interceptors, pipes and handler - SKIPPED
Show the answer

Correct order:

  1. Middleware - EXECUTED
  2. Guard - REJECTS request
  3. Interceptors, pipes and handler - SKIPPED
  4. Exception Filter - HANDLES ForbiddenException