-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
ExceptionHandlerExceptionResolver should support exceptions from any handler #22619
Comments
Originally I think we could use the |
It would be nice to be able to centralize error handing and also to be able to contribute error handling logic, eg, in a Spring Boot autoconfig. As it is I can’t reuse |
As we are now supporting the functional reactive webflux dsl in spring MVC it would also be nice to share |
@joshlong indeed this is another use case for this. I've broadened the title accordingly. |
I think one thing that would be nice would be an easy way to configure on setup a method that gets called after an exception gets handled. Currently I'm using controlleradvice to handle exceptions, but this gets missed when an exception occurs from a filter. I want a way to just easily log all exceptions that are uncaught. |
I have also encountered this problem. I can handle all exceptions in a custom ExceptionFilter just like Spring Security did with ExceptionTranslationFilter. |
Ran into the same issue. We use Atlassian's A centralized This works perfectly when request URL is handled by a Controller (i.e. |
@adaykin, @medusar, @grimsa, the original request is for |
This is now supported through the |
@rstoyanchev Sorry for requesting reopen. I encountered problem when setting
Is there any clever way to resolve this issue? Currently, I have to work around in the same way @vghero do. |
@haupv1m can you create a separate issue? |
@rstoyanchev I already create new issue #26772 |
Affects: Spring 5.0.9
I have a Spring Boot service where custom JSON error responses are returned for cases like 400, 404, 415, 500 etc. This works great by using
@ExceptionHandler
.Recently we added static resources to the mix. But when accessing one of them that does not exist, the default Spring 404 JSON body is returned instead of ours. As it turns out,
ExceptionHandlerExceptionResolver
and superclasses are refusing to resolve due to the fact that the handler method is not instance ofHandlerMethod
butResourceHttpRequestHandler
and error handling ends up somewhere in dispatcher servlet with the "default" 404 response.I've managed to re-use
ExceptionHandlerExceptionResolver
also for static resources not found, but it is quite hackish and does not feel right - see below. Are there any plans to add support for this toExceptionHandlerExceptionResolver
? Or did I overlook something?The text was updated successfully, but these errors were encountered: