Compare commits
2 Commits
75be48c3b0
...
1891902cb9
| Author | SHA1 | Date | |
|---|---|---|---|
| 1891902cb9 | |||
| 9d4a5afb49 |
@@ -18,6 +18,7 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
|
|||||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
import org.springframework.web.client.ResourceAccessException;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
@@ -158,6 +159,21 @@ public class GlobalExceptionHandler {
|
|||||||
return R.fail(message);
|
return R.fail(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级系统(L2)连接失败
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(ResourceAccessException.class)
|
||||||
|
public R<Void> handleResourceAccessException(ResourceAccessException e, HttpServletRequest request) {
|
||||||
|
String requestURI = request.getRequestURI();
|
||||||
|
String message = e.getMessage();
|
||||||
|
if (message != null && (message.contains("Connection refused") || message.contains("sql-server-api"))) {
|
||||||
|
log.error("请求地址'{}', 二级系统连接失败'{}'", requestURI, message);
|
||||||
|
return R.fail(503, "二级系统状态异常,已停机,请稍后重试或联系管理员确认");
|
||||||
|
}
|
||||||
|
log.error("请求地址'{}', 资源访问异常", requestURI, e);
|
||||||
|
return R.fail("服务连接异常,请稍后重试");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 演示模式异常
|
* 演示模式异常
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user