|
@@ -2,12 +2,17 @@ package com.yonge.cooleshow.mall.common.exception;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.microsvc.toolkit.common.response.enums.ESysMap;
|
|
|
+import com.microsvc.toolkit.common.response.template.R;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.util.http.HttpUtil;
|
|
|
import com.yonge.cooleshow.mall.common.api.CommonResult;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.validation.BindException;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.validation.FieldError;
|
|
@@ -127,6 +132,26 @@ public class GlobalExceptionHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 默认异常信息
|
|
|
+ * @param ex Exception
|
|
|
+ * @return ResponseEntity<JSONObject>
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @ExceptionHandler(Throwable.class)
|
|
|
+ public CommonResult defaultExceptionMapper(Throwable ex) {
|
|
|
+
|
|
|
+ Throwable throwable = getThrowable(ex);
|
|
|
+ log.error("defaultExceptionMapper ", throwable);
|
|
|
+
|
|
|
+ // dingTalk机器人通知
|
|
|
+ sendDingTalkRobotNotify(throwable);
|
|
|
+
|
|
|
+ return CommonResult.failed("系统异常");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 请求日志
|
|
|
* @param request HttpServletRequest
|