nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

NestJS/Exception Handling

Build APIs that fail predictably and return useful errors instead of confusing server responses.

15 QuestionsIntermediateHigh Priority ~10 min read

Applications will eventually encounter errors, whether a user sends invalid data, a resource does not exist, or a database operation fails. NestJS provides built-in HTTP exceptions and a standard exception handling system so these failures can be turned into meaningful responses.

Good exception handling is about more than catching errors. You need to decide which errors should be exposed to clients, how responses should be structured, and where unexpected errors should be logged without leaking sensitive implementation details.

What you'll walk away knowing

How NestJS built-in HTTP exceptions work
How to create and throw custom exceptions
How exception filters customize error responses
How to handle unexpected errors safely
1What are the two ways to register a global exception filter in NestJS and what is the key difference?Intermediate2How do you handle exceptions differently in a filter depending on whether the request is HTTP, WebSocket, or RPC?Intermediate3What does the @Catch() decorator do and what happens when you omit its argument?Intermediate4How do you register multiple global filters that each handle a different exception type in NestJS?Intermediate5How do you prevent sensitive information from leaking through exception responses in production NestJS apps?Intermediate6How do you create a domain-specific custom exception class in NestJS?Intermediate7How do you extend the built-in BaseExceptionFilter to add logging while keeping default NestJS behaviour?Intermediate8How does exception filter resolution order work when multiple filters are registered at different levels in NestJS?Intermediate9How do you write an exception filter that handles GraphQL errors differently from REST errors in NestJS?Intermediate10How do you add custom response headers or set cookies inside an exception filter in NestJS?Intermediate11How do you re-throw an exception from within a filter to let a higher-scoped filter handle it in NestJS?Intermediate12How do you integrate a third-party error tracker like Sentry inside a global exception filter in NestJS?Intermediate13How do you handle async operations inside an exception filter in NestJS, for example logging to a database?Intermediate14What is HttpException in NestJS and what two arguments does its constructor take?Intermediate15What built-in HTTP exceptions does NestJS provide out of the box?Beginner16How do you apply an exception filter at the method, controller, and global level in NestJS?Intermediate17What interface must an exception filter implement and what are the two parameters of catch()?Intermediate18How do you implement a filter that adds a request correlation ID to every error response in NestJS?Intermediate19What is the cause option on HttpException and how should you use it for error tracing?Intermediate20How do interceptors and exception filters divide error-handling responsibility in NestJS?Intermediate21How do getResponse() and getStatus() work on an HttpException and what can getResponse() return?Intermediate22How do you map database and ORM exceptions to HTTP exceptions using a global filter in NestJS?Intermediate23How do you unit test an exception filter in NestJS?Intermediate24What does NestJS's built-in global exception layer do when no custom filter is registered?Beginner25How do you write a production-ready global all-exceptions filter that handles HttpException and unexpected errors differently?Advanced
All Topics
1
Basics
Modules
Controllers
Dependency Injection
Providers
2
Request Lifecycle
Middleware
Guards
Interceptors
Pipes
Filters
Exception Handling
3
Decorators
Architecture
API Design
4
GraphQL
Database and ORM
Microservices
5
Authentication and Authorization
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.