Commit e4966f0d authored by WeiWei's avatar WeiWei

优化异常配置

parent 47f618a4
......@@ -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>
......@@ -98,13 +96,13 @@ public class ApplicationExceptionConfiguration {
Throwable cause = e;
while ((cause = cause.getCause()) != null) {
if (cause instanceof ApplicationException) {
if (ApplicationException.class.isAssignableFrom(cause.getClass())) {
cause = cause.getCause();
break;
}
}
return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR, cause.getMessage());
return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR, ApplicationException.class.isAssignableFrom(e.getClass()) ? cause.getMessage() : e.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