For debugging purposes, yes, but in production the original exception is more important. Note that AnotherException is also logged at warn level which is intended to assist with debugging.
Either way this is a confusing situation that you need to try and avoid (i.e. control exceptions in exception handling code more tightly). It is long standing, existing behavior that cannot change without causing regressions.
So you're actually raising the exception intentionally from the @ExceptionHandler method, and not just simulating an unexpected error during from an @ExceptionHandler. This is certainly not something that an @ExceptionHandler was designed for. I actually don't understand what you're trying to do. What do you want to happen to AnotherException, propagate to the Servlet container and become a 500?
WhatAKitty opened SPR-16375 and commented
The controller file:
The exception handler file:
I think when I visit this controller method, it will give me the response as below:
But unfortunately, the result is this:
It will make people confused, especially if you have some code error in exception handler instead of throw exception manually as above.
Affects: 4.3.10
The text was updated successfully, but these errors were encountered: