From 2050ea2cd30a6273a38fe526125c2fa0f1e836fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=BA=86=E5=90=89?= <51312040@qq.com> Date: Thu, 25 Feb 2021 18:39:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=9F=E4=B8=80=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessExceptionHandlerAdvice.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvice.java b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvice.java index 7561f35..ea3313f 100644 --- a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvice.java +++ b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvice.java @@ -60,7 +60,7 @@ public class BusinessExceptionHandlerAdvice { //堆栈信息转为字符串 log.info(ExceptionUtil.stacktraceToString(exception)); Map body = new HashMap<>(); - body.put("path", request.getRequestURI()); +// body.put("path", request.getRequestURI()); return BaseResponse.fail(exception.getCode(), exception.getMessage(), Convert.toStr(body)); } @@ -90,7 +90,7 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", JsonUtils.objectToJson(invalidArguments)); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); - body.put("path", request.getRequestURI()); +// body.put("path", request.getRequestURI()); return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数验证错误", Convert.toStr(body)); } @@ -118,7 +118,7 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", JsonUtils.objectToJson(invalidArguments)); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); - body.put("path", request.getRequestURI()); +// body.put("path", request.getRequestURI()); return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数错误", Convert.toStr(body)); } @@ -135,7 +135,7 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); body.put("error", HttpStatus.METHOD_NOT_ALLOWED.getReasonPhrase()); - body.put("path", request.getRequestURI()); +// body.put("path", request.getRequestURI()); return BaseResponse.fail(HttpStatus.METHOD_NOT_ALLOWED.value(), "错误的请求方式", Convert.toStr(body)); } @@ -152,8 +152,8 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); - body.put("path", request.getRequestURI()); - return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数缺失", Convert.toStr(body)); +// body.put("path", request.getRequestURI()); + return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数缺失" + exception.getMessage(), Convert.toStr(body)); } // ----------------------------data-------------------------------------- @@ -172,8 +172,8 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); - body.put("path", request.getRequestURI()); - return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "数据库异常", Convert.toStr(body)); +// body.put("path", request.getRequestURI()); + return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "数据库异常" + exception.getMessage(), Convert.toStr(body)); } /** @@ -189,7 +189,7 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); - body.put("path", request.getRequestURI()); +// body.put("path", request.getRequestURI()); return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "数据不存在", Convert.toStr(body)); } @@ -206,7 +206,7 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); - body.put("path", request.getRequestURI()); +// body.put("path", request.getRequestURI()); return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "数据重复插入", Convert.toStr(body)); } @@ -223,7 +223,7 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); body.put("error", HttpStatus.BAD_REQUEST.getReasonPhrase()); - body.put("path", request.getRequestURI()); +// body.put("path", request.getRequestURI()); return BaseResponse.fail(HttpStatus.BAD_REQUEST.value(), "参数类型不匹配", Convert.toStr(body)); } @@ -242,8 +242,8 @@ public class BusinessExceptionHandlerAdvice { Map body = new HashMap<>(); body.put("errors", exception.getMessage()); body.put("error", HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase()); - body.put("path", request.getRequestURI()); - return BaseResponse.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), "网络异常", Convert.toStr(body)); +// body.put("path", request.getRequestURI()); + return BaseResponse.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), "系统异常:" + exception.getMessage(), Convert.toStr(body)); } /**