Commit 386ac95d by 陈健智

异常打印调整

parent bea1ff0b
...@@ -20,12 +20,14 @@ public class CustomException extends RuntimeException { ...@@ -20,12 +20,14 @@ public class CustomException extends RuntimeException {
private final Exception exception; private final Exception exception;
public CustomException(ResultCode resultCode) { public CustomException(ResultCode resultCode) {
super(resultCode.message());
this.resultCode = resultCode; this.resultCode = resultCode;
this.errorMessage = null; this.errorMessage = resultCode.message();
this.exception = null; this.exception = null;
} }
public CustomException(ResultCode resultCode, String errorMessage, Exception e) { public CustomException(ResultCode resultCode, String errorMessage, Exception e) {
super(errorMessage);
this.resultCode = resultCode; this.resultCode = resultCode;
this.errorMessage = errorMessage; this.errorMessage = errorMessage;
this.exception = e; this.exception = e;
......
...@@ -34,9 +34,9 @@ public class ExceptionCatch { ...@@ -34,9 +34,9 @@ public class ExceptionCatch {
Exception exception = customException.getException(); Exception exception = customException.getException();
//记录日志 //记录日志
if (null == exception) { if (null == exception) {
log.info("catch exception-custom:{}", customException.getErrorMessage()); log.error("catch exception-custom:{}", customException.getErrorMessage(), customException);
} else { } else {
log.error("catch exception-custom:{}", customException.getErrorMessage(), exception); log.error("catch exception:{}", customException.getErrorMessage(), exception);
} }
return new ResponseResult(resultCode, Collections.EMPTY_LIST); return new ResponseResult(resultCode, Collections.EMPTY_LIST);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment