codejump

Cross-Cutting Concerns

Preview — 3 of 10 questions

A method-level @Catch(ConflictException) filter and a global @Catch() catch-all both exist. A ConflictException is thrown. Which handles it and why?

AThe global catch-all, because broader filters win
BThe method-level specific filter, because scope precedence (method > controller > global) and specificity favor the nearer, more specific filter
CBoth run, specific first
DNeither — Nest uses the default handler

What is the cleanest pattern to report all unhandled errors to Sentry while preserving Nest's default responses?

AWrap every controller method in try/catch and call Sentry manually
BAdd Sentry to a pipe
CExtend BaseExceptionFilter, capture non-HTTP (or 5xx) exceptions to Sentry, then delegate to super.catch()
DLog errors only in middleware

You have pure domain exceptions (e.g., OrderAlreadyShippedError) that must not import @nestjs/common. How do you map them to HTTP responses?

AMake every domain error extend HttpException
BReturn status codes directly from the domain layer
CKeep domain errors framework-free and add an exception filter that maps each domain error type to the appropriate HttpException/status
DCatch them in middleware

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.