Hi i have one question
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(value = Throwable.class)
public ErrorResponse handleException(final Throwable ex) {
LOG.error(ex.getMessage(), ex);
return new ErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR.value(),
ex.getClass().getSimpleName(), "An internal error occurred");
}
Is this exception handler is only for synchronous calls to some service from Rest Controllers. If I have some asynchronous tasks(spring managed? Ex: @Async methods), and exception occurs, most probably the exception will not be propagated here. Is it true?
or I should use Thread.setDefaultExceptionHandler()