title: Can we throw an exception in fallback or fallbackFactory of @FeignClient
body: <p>I'm use the @FeignClient and want to do some logic(like record the exception information) when Feign throw Exception and then reply the result to front end.</p>
  
  <p>I noticed Feign will throw FeignException when connection fail or http status not expect.</p>
  
  <p>So I defined a @ExceptionHandler to caught FeignException after the callback method was invoked.</p>
  
  <pre><code>    @ExceptionHandler(value = FeignException.class)
      @ResponseBody
      public ResponseResult feignException(FeignException exception){
          String message = exception.getMessage();
          byte[] content = exception.content();
          int status = exception.status();
          if(content!=null){
              String response=new String(content);
              message=String.format("%s response message : %s",message,response);
          }
          log.warn("{} : {} , cause by : {}",exception.getClass().getSimpleName(),message,exception.getCause());
          return ResponseResult.fail(HttpStatus.valueOf(status),String.format("9%s00",status),message);
  </code></pre>
  
  <p>But it can't caught when I set the callback or callbackFactory of @FeignClient.</p>
  
  <pre><code>    @FeignClient(url = "${onboardingcase.uri}",name = "OnBoardingCaseService",
              fallbackFactory = OnBoardingCaseServiceFallBack.class)
  
  
  @Component
  @Slf4j
  public class OnBoardingCaseServiceFallBack implements FallbackFactory&lt;OnBoardingCaseService&gt; {
  
      @Override
      public OnBoardingCaseService create(Throwable throwable) {
          return new OnBoardingCaseService() {
              @Override
              public OnBoardingCaseVo query(String coid) {
  
                  if(throwable instanceof FeignException){
                      throw (FeignException)throwable;
                  }
                  return null;
              }
          };
      }
  }
  </code></pre>
  
  <p>I noticed because hystrix took over this method.And will catch exception in HystrixInvocationHandler.</p>
  
  <pre><code>try {
                                  Object fallback = HystrixInvocationHandler.this.fallbackFactory.create(this.getExecutionException());
                                  Object result = ((Method)HystrixInvocationHandler.this.fallbackMethodMap.get(method)).invoke(fallback, args);
                                  if (HystrixInvocationHandler.this.isReturnsHystrixCommand(method)) {
                                      return ((HystrixCommand)result).execute();
                                  } else if (HystrixInvocationHandler.this.isReturnsObservable(method)) {
                                      return ((Observable)result).toBlocking().first();
                                  } else if (HystrixInvocationHandler.this.isReturnsSingle(method)) {
                                      return ((Single)result).toObservable().toBlocking().first();
                                  } else if (HystrixInvocationHandler.this.isReturnsCompletable(method)) {
                                      ((Completable)result).await();
                                      return null;
                                  } else {
                                      return HystrixInvocationHandler.this.isReturnsCompletableFuture(method) ? ((Future)result).get() : result;
                                  }
                              } catch (IllegalAccessException var3) {
                                  throw new AssertionError(var3);
                              } catch (ExecutionException | InvocationTargetException var4) {
                                  throw new AssertionError(var4.getCause());
                              } catch (InterruptedException var5) {
                                  Thread.currentThread().interrupt();
                                  throw new AssertionError(var5.getCause());
                              }
  </code></pre>
  
  <p>So I want to know how can I throw an exception when I using callback / callbackFactory or there is another way to instead callbackFactory to do the "call back"? </p>
  
  <p>Many Thanks</p>