Commit 6fd38535 authored by WeiWei's avatar WeiWei

提出不用的代码

parent 362c2909
...@@ -36,7 +36,6 @@ public class ApplicationExceptionConfiguration { ...@@ -36,7 +36,6 @@ public class ApplicationExceptionConfiguration {
*/ */
@ExceptionHandler({ApplicationException.class}) @ExceptionHandler({ApplicationException.class})
public Result applicationExceptionHandler(ApplicationException e) { public Result applicationExceptionHandler(ApplicationException e) {
log.error("程序员开小差了,系统异常信息:{}", e.getMessage());
return new Result<>(e.getStatus(), null, e.getStatus().getMessage()); return new Result<>(e.getStatus(), null, e.getStatus().getMessage());
} }
...@@ -96,19 +95,9 @@ public class ApplicationExceptionConfiguration { ...@@ -96,19 +95,9 @@ public class ApplicationExceptionConfiguration {
@ExceptionHandler({Throwable.class}) @ExceptionHandler({Throwable.class})
public Result generalException(Throwable e) { public Result generalException(Throwable e) {
Throwable cause = e; log.error(e.getMessage(), e);
while ((cause = cause.getCause()) != null) { return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR);
if (ApplicationException.class.isAssignableFrom(cause.getClass())) {
cause = cause.getCause();
break;
}
}
String errorMessage = ApplicationException.class.isAssignableFrom(e.getClass()) ? cause.getMessage() : e.getMessage();
log.error("程序员开小差了,未明确的异常信息:{}", e);
return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR, ApplicationStatus.INTERNAL_SERVICE_ERROR.getMessage());
} }
......
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