-
-
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
Chain multiple exception filters execution #3252
Comments
Exception filters were designed to be a pointcut. If you want to log every exception and at the same time, have multiple filters registered, wouldn't it be more predictable to use composition/inheritance instead? In case you want to make it even more dynamic, you could create a |
Okay, but we can potentially have a chain of inheritance of which is hard to maintain at some later point, so we were wondering if there is a possibility to easy that out. |
You can use composition in this case. |
Okay, thanks for the feedback. We will look into which solutions could be the best way to achieve it. |
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. |
Feature Request
Is your feature request related to a problem? Please describe.
The issue is that I am not able to execute two exception filters as the filter themselves are actually single pointcut for the chain.
Describe the solution you'd like
The first option would be to have
Filter
with a similar syntax toInterceptor
such that developers can decide if theFilter
is a pointcut or not.A second option would be to apply a
Pipe
or anInterceptor
at different levels, such as to catch errors fromGuard
.What is the motivation/use case for changing the behavior?
A request comes into the following API
Each step can potentially throw an
Exception
, not necessarely anHttpException
.The
Exception
transformation is done in aFilter
in order to be able to catch errors coming from any step.As a new feature, I would like to have a logger to log every exception that is happening, potentially with the
ExecutionContext
from which is thrown, without having to change my existing filter to comply with SRP and prevent mixing up logging with transformation.Possible scenarios:
Middleware
would not have theExecutionContext
.ExceptionLoggingInterceptor
would not be called to log if the failure point isTraceMiddleware
orAuthGuard
.Filter
would not be run together with theTransformExceptionFilter
.The text was updated successfully, but these errors were encountered: