Commit 8d4380e9 authored by xiaozhe.chen's avatar xiaozhe.chen

暂时修改一下这个方法吧generalException

parent c61f2a2f
...@@ -94,18 +94,25 @@ public class ApplicationExceptionConfiguration { ...@@ -94,18 +94,25 @@ public class ApplicationExceptionConfiguration {
*/ */
@ExceptionHandler({Throwable.class}) @ExceptionHandler({Throwable.class})
public Result generalException(Throwable e) { public Result generalException(Throwable e) {
Throwable parent;
Throwable child = e.getCause();
Throwable cause = e.getCause(); while (Objects.nonNull(child)) {
parent = child;
child = parent.getCause();
}
return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR, child.getMessage());
/*
while (Objects.nonNull(cause.getCause())) { while (Objects.nonNull(cause.getCause())) {
if (cause instanceof ApplicationException) { //todo 如果抛出的不是ApplicationException,是不是就成了死循环 if (cause instanceof ApplicationException) { //todo 如果抛出的不是ApplicationException,是不是就成了死循环
cause = cause.getCause(); cause = cause.getCause();
} }
} }
return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR, cause.getMessage()); return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR, cause.getMessage());
*/
} }
} }
\ No newline at end of file
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