Commit 4cc674ea authored by jiaorz's avatar jiaorz

异常邮件处理

parent 8c21ca38
...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.exception.auth.ClientTokenException; ...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.exception.auth.ClientTokenException;
import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException; import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException;
import com.github.wxiaoqi.security.common.exception.auth.UserTokenException; import com.github.wxiaoqi.security.common.exception.auth.UserTokenException;
import com.github.wxiaoqi.security.common.msg.BaseResponse; import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.util.HttpRequestUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
...@@ -66,6 +67,7 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { ...@@ -66,6 +67,7 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
if(0 == ex.getStatus()) { if(0 == ex.getStatus()) {
response.setStatus(500); response.setStatus(500);
} }
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + ex);
return new BaseResponse(ex.getStatus(), ex.getMessage()); return new BaseResponse(ex.getStatus(), ex.getMessage());
} }
...@@ -73,6 +75,7 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { ...@@ -73,6 +75,7 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
public BaseResponse otherExceptionHandler(HttpServletResponse response, Exception ex) { public BaseResponse otherExceptionHandler(HttpServletResponse response, Exception ex) {
response.setStatus(500); response.setStatus(500);
logger.error(ex.getMessage(),ex); logger.error(ex.getMessage(),ex);
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + ex);
return new BaseResponse(CommonConstants.EX_OTHER_CODE, ex.getMessage()); return new BaseResponse(CommonConstants.EX_OTHER_CODE, ex.getMessage());
} }
} }
...@@ -28,11 +28,11 @@ public class PlatformExceptionHandler { ...@@ -28,11 +28,11 @@ public class PlatformExceptionHandler {
Throwable cause = e.getCause(); Throwable cause = e.getCause();
if(cause != null && cause.toString().contains("Exception")) { if(cause != null && cause.toString().contains("Exception")) {
log.error(cause.getMessage(), e); log.error(cause.getMessage(), e);
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + e.getMessage()); HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + e);
return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage()); return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage());
} }
log.error("Server exception: ", e); log.error("Server exception: ", e);
HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + e.getMessage()); HttpRequestUtil.httpGet("http://10.5.52.3:8765/api/universal/mail/app/unauth/send?toUser=jiaoruizhen@126.com&subject=服务器异常&content=" + e);
return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + e.getMessage()); return assembleResult(ObjectRestResponse.createFailedResult(5000, "服务器开小差了,请稍后重试!"), "Server exception: " + 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