修改统一异常处理

This commit is contained in:
付庆吉
2021-03-25 19:00:05 +08:00
parent aa37c3e536
commit 22e9aa78e8

View File

@ -161,7 +161,7 @@ public class BusinessExceptionHandlerAdvice {
body.put("errors", exception.getMessage()); body.put("errors", exception.getMessage());
body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase());
// body.put("path", request.getRequestURI()); // body.put("path", request.getRequestURI());
return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数缺失" + exception.getMessage(), Convert.toStr(body)); return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数缺失", Convert.toStr(body));
} }
// ----------------------------data-------------------------------------- // ----------------------------data--------------------------------------
@ -181,7 +181,7 @@ public class BusinessExceptionHandlerAdvice {
body.put("errors", exception.getMessage()); body.put("errors", exception.getMessage());
body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase());
// body.put("path", request.getRequestURI()); // body.put("path", request.getRequestURI());
return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "数据库异常" + exception.getMessage(), Convert.toStr(body)); return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "数据库异常", Convert.toStr(body));
} }
/** /**
@ -253,7 +253,7 @@ public class BusinessExceptionHandlerAdvice {
body.put("errors", exception.getMessage()); body.put("errors", exception.getMessage());
body.put("error", HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase()); body.put("error", HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase());
// body.put("path", request.getRequestURI()); // body.put("path", request.getRequestURI());
return BaseResponse.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), "系统异常" + exception.getMessage(), return BaseResponse.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), "系统异常",
Convert.toStr(body)); Convert.toStr(body));
} }