use of org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler in project CzechIdMng by bcvsolutions.
the class AsyncConfig method getAsyncUncaughtExceptionHandler.
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
// simple error logging
return new AsyncUncaughtExceptionHandler() {
@Override
public void handleUncaughtException(Throwable throwable, Method method, Object... obj) {
if (throwable instanceof ResultCodeException) {
ResultCodeException ex = (ResultCodeException) throwable;
LOG.error("[" + ex.getId() + "] ", ex);
} else {
ErrorModel errorModel = new DefaultErrorModel(CoreResultCode.INTERNAL_SERVER_ERROR, throwable.getMessage());
LOG.error("[" + errorModel.getId() + "] ", throwable);
}
}
};
}
Aggregations