I have an exception handler defined as following in a Spring controller:
@ExceptionHandler(Customized4ExceptionHandler.class)
public void handleCustomized4Exception(
Customized4ExceptionHandler ex,
HttpServletRequest request,
HttpServletResponse response) throws IOException {
response.sendError(HttpStatus.EXPECTATION_FAILED.value(),
"zzzzzzz");
}
When the error is triggered, I get the following on the user side:

The error code is correct, but the “zzzzzzz” descriptive message is not displayed. How can I display it on the user side?
My Javascript is:
$.ajax({
type: 'GET',
url: prefix + "/throwCustomized4ExceptionHandler",
dataType: 'json',
async: true,
success: function(result) {
alert('Unexpected success !!!');
},
error: function(jqXHR, textStatus, errorThrown) {
alert(jqXHR.status + " "
+ textStatus + " "
+ errorThrown + " !");
}
});
I solved the problem as following:
and