I’m overriding resolveException in SimpleMappingExceptionResolver in order to send an email with the stacktrace which works for 500 errors but a 400 error does not arrive at this method. (There is no stacktrace to send but I’d 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 similar)?
I think you’ll find this answer helpful:
Spring SimpleMappingExceptionResolver not going to default view
TL;DR Spring ExceptionResolvers don’t handle all exceptions, just those thrown by Controllers. A “400 – Bad Request” can be thrown when Spring can’t convert your submission data for a mapped controller, and the exception it throws would never be seen by your ExceptionHandler.
Your web.xml solution should work nicely.