Bird
0
0

What will happen if the LoggingInterceptor's intercept method does not call next.handle()?

medium📝 Predict Output Q5 of 15
NestJS - Interceptors
What will happen if the LoggingInterceptor's intercept method does not call next.handle()?
AThe interceptor will throw a syntax error
BThe request will hang and never complete
CThe request will complete immediately without logging
DThe request will be redirected to an error page
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of next.handle()

    next.handle() passes control to the next handler in the chain.
  2. Step 2: Consequence of omitting next.handle()

    Without calling it, the request processing stops and hangs indefinitely.
  3. Final Answer:

    The request will hang and never complete -> Option B
  4. Quick Check:

    Missing next.handle() = Request hangs [OK]
Quick Trick: Always call next.handle() to continue request flow [OK]
Common Mistakes:
  • Thinking request completes without next.handle()
  • Expecting syntax errors instead of runtime hang
  • Assuming automatic error redirection

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes