Welcome to the Part 7 of NestJS Basics.
In the previous post, we looked at the in-built exception handling in NestJS. The main topics were as follows:
Understanding the global exception filter
How to throw standard exceptions?
How to customize the exceptions for better control?
In-build exception handling is a pretty robust way of handling exceptions in NestJS without.
If you haven’t gone through it yet, you can check out the post on NestJS in-built exception handling below:
In today’s post, I’m going to cover the NestJS Exception Filter, which is a much more flexible approach to handling exceptions.
The Plan
Here are the things we will cover in this post.
What is an Exception Filter?
The role of generic interface
The
catch()
method
How to create a Custom Exception Filter?
Understanding the
ArgumentsHost
How to use the Custom Exception Filter?
method-level
controller-level
global
As usual, every step will be accompanied by appropriate code examples.
Want to learn NestJS but haven't joined ProgressiveCoder's paid subscription yet?
Don't delay, join now to gain instant access to the course and unlock exclusive content and support.