瀏覽代碼

异常日志输出

xujunwei 3 年之前
父節點
當前提交
fc4b6006bd
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      framework-boot/src/main/java/com/mrxu/framework/boot/handle/FeignErrorHandler.java

+ 3 - 0
framework-boot/src/main/java/com/mrxu/framework/boot/handle/FeignErrorHandler.java

@@ -5,12 +5,14 @@ import com.mrxu.framework.common.util.BusinessException;
 import feign.Response;
 import feign.Util;
 import feign.codec.ErrorDecoder;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 
 import java.io.IOException;
 import java.lang.annotation.*;
 
+@Slf4j
 @Configuration
 public class FeignErrorHandler implements ErrorDecoder {
 
@@ -25,6 +27,7 @@ public class FeignErrorHandler implements ErrorDecoder {
     public Exception decode(String methodKey, Response response) {
         try {
             String rs = Util.toString(response.body().asReader());
+            log.error(rs);
             JSONObject result = JSONObject.parseObject(rs);
             return new BusinessException(result.getString("message"));
         }