update(REQ-2516) - 配合测试 X-Metadata-Tag 进行异常信息记录
This commit is contained in:
parent
6dd8fb4709
commit
6ee4430f43
@ -1,32 +0,0 @@
|
||||
package cn.axzo.workflow.starter.feign.ext;
|
||||
|
||||
import feign.Response;
|
||||
import feign.Util;
|
||||
import feign.codec.ErrorDecoder;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 为兼容 X-Metadata-Tag 的异常解码器
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2024/6/25 18:02
|
||||
*/
|
||||
public class WorkflowEngineStarterErrorDecoder implements ErrorDecoder {
|
||||
private final ErrorDecoder errorDecoder = new Default();
|
||||
|
||||
@Override
|
||||
public Exception decode(String methodKey, Response response) {
|
||||
if (response.status() != 512) {
|
||||
return errorDecoder.decode(methodKey, response);
|
||||
}
|
||||
byte[] body = {};
|
||||
try {
|
||||
if (response.body() != null) {
|
||||
body = Util.toByteArray(response.body().asInputStream());
|
||||
}
|
||||
} catch (IOException ignored) { // NOPMD
|
||||
}
|
||||
return new Exception();
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,6 @@ import feign.RequestTemplate;
|
||||
import feign.Retryer;
|
||||
import feign.Target;
|
||||
import feign.codec.Decoder;
|
||||
import feign.codec.ErrorDecoder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.MDC;
|
||||
@ -67,11 +66,6 @@ public class WorkflowEngineStarterFeignConfiguration {
|
||||
return new WorkflowEngineStarterDecoder(new ResponseEntityDecoder(new SpringDecoder(messageConverters)));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ErrorDecoder workflowEngineStarterErrorDecoder() {
|
||||
return new WorkflowEngineStarterErrorDecoder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RequestInterceptor workflowEngineStarterRequestInterceptor(WorkflowEngineStarterProperties starterProperties,
|
||||
Environment environment,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user