-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only the last one of APP_ providers get registered #812
Comments
After little investigation I found the problem. NestJS treats For this it would be I can make a PR if needed. Thanks regardless. |
We tried to register multiple Exception Filters via the provider token APP_FILTER and get the same problem. Only the last Exception filter catches any error, the other exceptions went to the client. |
Fixed in 5.1.0 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
If more than two APP_ providers are provided within one module, only the last of them actually gets registered.
Expected behavior
Both APP_FILTER providers should get registered. Same goes for 3+ and other types of APP providers.
Minimal reproduction of the problem with instructions
https://gist.github.com/autaut03/15af00e63cb41cad77e35c7cab1d1330
If any exception besides ForbiddenException is thrown anywhere in the app, it won't be catched by InternalServerErrorFilter. The same behaviour will persist even when more filters added, even for specific exceptions (BadRequestFilter for BadRequestException, for example).
What is the motivation / use case for changing the behavior?
This is a core functionality. In my case I want to register many exception handlers (filters) globally and still use dependency injection in them. As a workaround currently I use this:
which isn't exactly the best code and I still have to provide them within my AppModule.
Environment
The text was updated successfully, but these errors were encountered: