pull/1/head
tanghc 5 years ago
parent 1ab8e22885
commit 9429d32f42
  1. 2
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/result/BaseExecutorAdapter.java
  2. 2
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java

@ -96,6 +96,8 @@ public abstract class BaseExecutorAdapter<T, R> implements ResultExecutor<T, R>
responseData.put(GATEWAY_CODE_NAME, ISV_MISSING_METHOD_META.getCode());
responseData.put(GATEWAY_MSG_NAME, ISV_MISSING_METHOD_META.getError().getCode());
} else {
Map<String, Object> params = this.getApiParam(request);
log.error("微服务端报错,params:{}, 微服务返回结果:{}", params, serviceResult);
this.storeError(request, ErrorType.UNKNOWN);
// 微服务端有可能返回500错误
// {"path":"/book/getBook3","error":"Internal Server Error","message":"id不能为空","timestamp":"2019-02-13T07:41:00.495+0000","status":500}

@ -2,6 +2,7 @@ package com.gitee.sop.gatewaycommon.zuul.configuration;
import com.gitee.sop.gatewaycommon.bean.ApiContext;
import com.gitee.sop.gatewaycommon.result.ResultExecutor;
import com.gitee.sop.gatewaycommon.zuul.ZuulContext;
import com.netflix.zuul.context.RequestContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.servlet.error.ErrorController;
@ -35,6 +36,7 @@ public class ZuulErrorController implements ErrorController {
}
ctx.setResponseStatusCode(HttpStatus.OK.value());
Throwable throwable = ctx.getThrowable();
log.error("zuul网关报错,params:{}", ZuulContext.getApiParam(), throwable);
return this.buildResult(throwable);
}

Loading…
Cancel
Save