diff --git a/eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java b/eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java index 0f4ecf19e..65a4937ae 100644 --- a/eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java +++ b/eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java @@ -26,8 +26,8 @@ public class GlobalExceptionHandler { * @param e * @return */ - @ExceptionHandler(Exception.class) - public ResponseEntity handleException(Exception e){ + @ExceptionHandler(Throwable.class) + public ResponseEntity handleException(Throwable e){ // 打印堆栈信息 log.error(ThrowableUtil.getStackTrace(e)); ApiError apiError = new ApiError(BAD_REQUEST.value(),e.getMessage()); diff --git a/eladmin-logging/src/main/java/me/zhengjie/aspect/LogAspect.java b/eladmin-logging/src/main/java/me/zhengjie/aspect/LogAspect.java index b864423a8..7c4483163 100644 --- a/eladmin-logging/src/main/java/me/zhengjie/aspect/LogAspect.java +++ b/eladmin-logging/src/main/java/me/zhengjie/aspect/LogAspect.java @@ -42,14 +42,10 @@ public void logPointcut() { * @param joinPoint join point for advice */ @Around("logPointcut()") - public Object logAround(ProceedingJoinPoint joinPoint){ + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { Object result = null; currentTime = System.currentTimeMillis(); - try { - result = joinPoint.proceed(); - } catch (Throwable e) { - throw new BadRequestException(e.getMessage()); - } + result = joinPoint.proceed(); Log log = new Log("INFO",System.currentTimeMillis() - currentTime); logService.save(joinPoint, log); return result;