What is the difference between a global and a controller-level error handler in NestJS?

Responsive Ad Header

Question

Grade: Education Subject: Support
What is the difference between a global and a controller-level error handler in NestJS?
Asked by:
87 Viewed 87 Answers

Answer (87)

Best Answer
(339)
Global error handlers are applied application-wide, catching exceptions that are not handled by any controller-level error handlers. Controller-level error handlers are specific to a particular controller or module. Controller-level handlers take precedence over global handlers for exceptions originating within that controller or module.