public void invokeAfterPropertiesSet() throws Exception { feign.codec.ErrorDecoder errorDecoder = null; String[] beanNameArray = this.applicationContext.getBeanNamesForType(feign.codec.ErrorDecoder.class); for (int i = 0; beanNameArray != null && i < beanNameArray.length; i++) { String beanName = beanNameArray[i]; Object beanInst = this.applicationContext.getBean(beanName); if (CompensableFeignErrorDecoder.class.isInstance(beanInst)) { continue; } else if (errorDecoder != null) { throw new RuntimeException("There are more than one feign.codec.ErrorDecoder exists!"); } else { errorDecoder = (feign.codec.ErrorDecoder) beanInst; } } if (errorDecoder == null) { errorDecoder = new ErrorDecoder.Default(); } // end-if (errorDecoder == null) this.delegate = errorDecoder; }
return super.decode(methodKey, response);
public void invokeAfterPropertiesSet() throws Exception { feign.codec.ErrorDecoder errorDecoder = null; String[] beanNameArray = this.applicationContext.getBeanNamesForType(feign.codec.ErrorDecoder.class); for (int i = 0; beanNameArray != null && i < beanNameArray.length; i++) { String beanName = beanNameArray[i]; Object beanInst = this.applicationContext.getBean(beanName); if (TransactionFeignErrorDecoder.class.isInstance(beanInst)) { continue; } else if (errorDecoder != null) { throw new RuntimeException("There are more than one feign.codec.ErrorDecoder exists!"); } else { errorDecoder = (feign.codec.ErrorDecoder) beanInst; } } if (errorDecoder == null) { errorDecoder = new ErrorDecoder.Default(); } // end-if (errorDecoder == null) this.delegate = errorDecoder; }
@Override public Exception decode(String methodKey, Response response) { Exception exception = super.decode(methodKey, response); if (response.status() >= 500) { return new RetryableException( exception.getMessage(), exception, null ); } return exception; } }
@org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean(feign.codec.ErrorDecoder.class) @org.springframework.context.annotation.Bean public feign.codec.ErrorDecoder errorDecoder() { return new ErrorDecoder.Default(); }
@Override public Exception decode(String methodKey, Response response) { FeignException exception = errorStatus(methodKey, response); Date retryAfter = retryAfterDecoder.apply(firstOrNull(response.headers(), RETRY_AFTER)); if (retryAfter != null) { return new RetryableException(exception.getMessage(), exception, retryAfter); } return exception; }