参数优化
parent
662e8bd02d
commit
8041df8d3f
|
|
@ -21,7 +21,7 @@ import org.springframework.http.HttpStatus;
|
||||||
public class SentinelExceptionHandler implements BlockExceptionHandler {
|
public class SentinelExceptionHandler implements BlockExceptionHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s, BlockException e) throws Exception {
|
public void handle(HttpServletRequest request, HttpServletResponse response, String resourceName, BlockException e) throws Exception {
|
||||||
String msg = "未知异常";
|
String msg = "未知异常";
|
||||||
int status = HttpStatus.TOO_MANY_REQUESTS.value();
|
int status = HttpStatus.TOO_MANY_REQUESTS.value();
|
||||||
if (e instanceof FlowException) {
|
if (e instanceof FlowException) {
|
||||||
|
|
@ -36,7 +36,7 @@ public class SentinelExceptionHandler implements BlockExceptionHandler {
|
||||||
} else if (e instanceof SystemBlockException) {
|
} else if (e instanceof SystemBlockException) {
|
||||||
msg = "系统规则限流或降级";
|
msg = "系统规则限流或降级";
|
||||||
}
|
}
|
||||||
ServletUtils.writeJSON(httpServletResponse, CommonResult.error(status, msg));
|
ServletUtils.writeJSON(response, CommonResult.error(status, msg));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue