mirror of https://github.com/elunez/eladmin
修复bug:重新catch再throw new Exception会导致部分堆栈信息丢失
parent
90c2bf906b
commit
5ece3a3d68
|
@ -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());
|
||||
|
|
|
@ -42,14 +42,10 @@ public class LogAspect {
|
|||
* @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());
|
||||
}
|
||||
Log log = new Log("INFO",System.currentTimeMillis() - currentTime);
|
||||
logService.save(joinPoint, log);
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue