Not all exceptions are mapped to Exception resolution in SimpleMappingExceptionResolver

I am overriding resolveException to SimpleMappingExceptionResolver to send an email with stacktrace that works for 500 errors, but error 400 does not reach this method. (There is no stacktrace sending, but I would still like to send an email and show a nice error page.)

Is there a way to do this, or should I just configure my web.xml to handle 400 (and the like)?

+4
source share
1 answer

I think you will find this answer useful:

Spring SimpleMappingExceptionResolver will not display by default

TL DR Spring ExceptionResolvers does not handle all exceptions, only those that are selected by the controllers. "400 - Bad Request" can be reset when Spring cannot convert your send data to the associated controller, and the exception it throws will never be seen by your ExceptionHandler.

Your web.xml solution should work well.

+1
source

All Articles