|
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author Liup
|
|
* @author Liup
|
|
@@ -22,16 +23,13 @@ public class ControllerExceptionHandler {
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@ExceptionHandler(Throwable.class)
|
|
@ExceptionHandler(Throwable.class)
|
|
public PageData exceptionHandler(Throwable ex) {
|
|
public PageData exceptionHandler(Throwable ex) {
|
|
- if (!isPromptException(ex)) {
|
|
|
|
- log.error(getExceptionAllInformation(ex));
|
|
|
|
|
|
+ log.error(getExceptionAllInformation(ex));
|
|
|
|
+ if (ex.getClass().getSimpleName().equals(WxErrorException.class.getSimpleName())) {
|
|
|
|
+ return AppUtil.error(ex.getMessage());
|
|
}
|
|
}
|
|
return AppUtil.error(ResultConstant.WEB_ERR_MSG);
|
|
return AppUtil.error(ResultConstant.WEB_ERR_MSG);
|
|
}
|
|
}
|
|
|
|
|
|
- private boolean isPromptException(Throwable ex) {
|
|
|
|
- return "com.chuwa.core.exception.PromptException".equals(ex.getClass().getName());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private static String getExceptionAllInformation(Throwable e) {
|
|
private static String getExceptionAllInformation(Throwable e) {
|
|
String sOut = e.toString() + "\r\n";
|
|
String sOut = e.toString() + "\r\n";
|
|
StackTraceElement[] trace = e.getStackTrace();
|
|
StackTraceElement[] trace = e.getStackTrace();
|