From b32b2300b0e86a753684779c9e9ea7a5cfe55e46 Mon Sep 17 00:00:00 2001 From: tanghc Date: Fri, 30 Aug 2019 19:08:25 +0800 Subject: [PATCH] 2.0 --- .../zuul/configuration/ZuulErrorController.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java index dd769e6e..18227f5d 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java @@ -35,12 +35,8 @@ public class ZuulErrorController implements ErrorController { if (ctx.getResponse() == null) { ctx.setResponse(response); } - ctx.setResponseStatusCode(HttpStatus.OK.value()); Throwable throwable = ctx.getThrowable(); - if (throwable == null) { - throwable = (Throwable) request.getAttribute("javax.servlet.error.exception"); - } - log.error("zuul网关报错,URL:{}, params:{}",request.getRequestURL().toString(), ZuulContext.getApiParam(), throwable); + log.error("请求错误,URL:{}, status:{}, params:{}",request.getRequestURL().toString(), ctx.getResponseStatusCode(), ZuulContext.getApiParam(), throwable); return this.buildResult(throwable); }