-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
interceptor not working with expressAdapter with Error in Guard #3065
Comments
Please, provide a minimal repository which reproduces your issue. |
I've updated the bug report. |
Interceptors are being evaluated after guards. You can't catch error thrown by guard inside an interceptor. |
Ok, thanks for the clarification |
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. |
Bug Report
Hi, I'm having issued with interceptor who aren't triggered when throwing a custom exception in a Guard. The setup of the nest application uses the
ExpressAdapter
from thenestjs/platform-express
packageCurrent behavior
Throw a a custom exception in a guard (which extends from
Error
)Both globally/locally registered custom error-Interceptor (like in the docs) is never reached.
The global nest-built-in catch-all filter triggers and throws a 500 exception.
When testing this exception with a global registered
Filter
instead ofInterceptor
, everythings works, and the Filter behaves as expected.Behaviour is also OK, when throwing an error OUTSIDE of a guard, for example in the controller itself.
Input Code
npm run offline
to run serverless ofline and test the '/hello' endpoint (both toggling interceptor and/or filter in main.ts)The custom errorinterceptor:
Expected behavior
The globally interceptor should be reached when throwing an
Error
within aGuard
Possible Solution
ExpressAdapter
?Environment
The text was updated successfully, but these errors were encountered: