title: How to throw exception based on feign.Response?
body: <p>I have a Feign client with a method returning the <code>feign.Response</code> class. When another service throws an exception, <code>feign</code> puts an exception message on response body and puts status, but my service does not throw an exception. Can I throw an exception based on what I received in response like when I use <code>ResponseEntity</code>.</p>
  
  <p><strong>Feign client</strong></p>
  
  <pre><code>@FeignClient(name = "ms-filestorage")
  @RequestMapping(value = "/files", produces = "application/json")
  public interface FileStorageApi {
  
      @GetMapping(value = "/{id}")
      Response getFileById(@PathVariable String id);
  }
  </code></pre>
  
  <p><strong>Usage of client</strong></p>
  
  <pre><code>@Override
  public Response getFileFromStorage(String fileId) {
      Response fileStorageResponse = fileStorageApi.getFileById(fileId);
  
      // NOW I USE THIS WAY FOR CHECKING RESPONSE BUT IT DOESN'T LOOK GOOD
      //if (fileStorageResponse.status() != HttpStatus.OK.value()) {
      //    throw new OsagoServiceException();
      //}
      return fileStorageResponse;
  }
  </code></pre>