pull/1/head
tanghc 5 years ago
parent ab21e1f9eb
commit 63775525cb
  1. 7
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/handler/GatewayExceptionHandler.java
  2. 5
      sop-sdk/sdk-csharp/readme.md

@ -1,7 +1,9 @@
package com.gitee.sop.gatewaycommon.gateway.handler; package com.gitee.sop.gatewaycommon.gateway.handler;
import com.gitee.sop.gatewaycommon.bean.ApiContext; import com.gitee.sop.gatewaycommon.bean.ApiContext;
import com.gitee.sop.gatewaycommon.gateway.ServerWebExchangeUtil;
import com.gitee.sop.gatewaycommon.gateway.result.GatewayResult; import com.gitee.sop.gatewaycommon.gateway.result.GatewayResult;
import com.gitee.sop.gatewaycommon.param.ApiParam;
import com.gitee.sop.gatewaycommon.result.ResultExecutor; import com.gitee.sop.gatewaycommon.result.ResultExecutor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -35,10 +37,9 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) { public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
ResultExecutor<ServerWebExchange, GatewayResult> resultExecutor = ApiContext.getApiConfig().getGatewayResultExecutor(); ResultExecutor<ServerWebExchange, GatewayResult> resultExecutor = ApiContext.getApiConfig().getGatewayResultExecutor();
GatewayResult errorResult = resultExecutor.buildErrorResult(exchange, ex); GatewayResult errorResult = resultExecutor.buildErrorResult(exchange, ex);
ApiParam apiParam = ServerWebExchangeUtil.getApiParam(exchange);
// 错误记录 // 错误记录
ServerHttpRequest request = exchange.getRequest(); log.error("gateway网关报错,params:{}, errorMsg:{}", apiParam, ex.getMessage(), ex);
log.error("[全局异常处理]异常请求路径:{}, msg:{}", request.getPath(), ex.getMessage(), ex);
// 参考AbstractErrorWebExceptionHandler // 参考AbstractErrorWebExceptionHandler
if (exchange.getResponse().isCommitted()) { if (exchange.getResponse().isCommitted()) {
return Mono.error(ex); return Mono.error(ex);

@ -1,9 +1,8 @@
# sdk-csharp # sdk-csharp
C#对应的SDK C#对应的SDK,由于本人使用mac开发,因此使用了.Net Core
- SDKCSharp: SDK源码,在此基础上添加接口 测试用例在`Program.cs`
- SDKTest: 测试用例
## 接口封装步骤 ## 接口封装步骤

Loading…
Cancel
Save