Commit f45d438a authored by WeiWei's avatar WeiWei

优化异常配置

parent b387cf5d
......@@ -16,8 +16,6 @@ import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.Objects;
/**
* 应用系统异常配置
* <p>
......@@ -95,11 +93,12 @@ public class ApplicationExceptionConfiguration {
@ExceptionHandler({Throwable.class})
public Result generalException(Throwable e) {
Throwable cause = e.getCause();
Throwable cause = e;
while (Objects.nonNull(cause.getCause())) {
while ((cause = cause.getCause()) != null) {
if (cause instanceof ApplicationException) {
cause = cause.getCause();
break;
}
}
......
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