title: spring feign client exception handling
body: <p>I have some fiegn client to send request other micro service. </p>
  
  <pre><code>@FeignClient(name="userservice")
  public interface UserClient {
  
      @RequestMapping(
              method= RequestMethod.GET,
                        path = "/userlist")
      String getUserByid(@RequestParam(value ="id") String id);
  
  }
  </code></pre>
  
  <p>Now I am sending request like this</p>
  
  <pre><code>try {
      String responseData = userClient.getUserByid(id);
      return responseData;
      }
  
  catch(FeignException e)
   {
   logger.error("Failed to get user", id);
  }
  
  catch (Exception e) 
  {
   logger.error("Failed to get user", id);
  }
  </code></pre>
  
  <p>Here the problem is if any FeignException happens I dont get any error code.</p>
  
  <p>I need to send a corresponding error codes in other APIS to send to caller </p>
  
  <p>So how to extract the error code?  I want to extract error code and build a responseEntity</p>
  
  <p>I got <a href="https://stackoverflow.com/questions/46662265/feign-client-error-handling">this</a> code but dont know how exactly I can use in my function. </p>