Class FeignClientExceptionErrorDecoder

java.lang.Object
org.bremersee.exception.feign.FeignClientExceptionErrorDecoder
All Implemented Interfaces:
feign.codec.ErrorDecoder

public class FeignClientExceptionErrorDecoder extends Object implements feign.codec.ErrorDecoder
This error decoder produces either a FeignClientException or a RetryableException.
Author:
Christian Bremer
  • Constructor Details

    • FeignClientExceptionErrorDecoder

      public FeignClientExceptionErrorDecoder()
      Instantiates a new feign client exception error decoder.
    • FeignClientExceptionErrorDecoder

      public FeignClientExceptionErrorDecoder(RestApiExceptionParser parser)
      Instantiates a new feign client exception error decoder.
      Parameters:
      parser - the parser
  • Method Details

    • decode

      public Exception decode(String methodKey, feign.Response response)
      Specified by:
      decode in interface feign.codec.ErrorDecoder
    • getResponseBody

      protected byte[] getResponseBody(feign.Response response)
      Get response body.
      Parameters:
      response - the response
      Returns:
      the body as byte array
    • getHttpMethod

      protected feign.Request.HttpMethod getHttpMethod(feign.Response response)
      Find http method.
      Parameters:
      response - the response
      Returns:
      the http method
    • determineRetryAfter

      protected Optional<Long> determineRetryAfter(String retryAfter)
      Determine retry after.
      Parameters:
      retryAfter - the retry after
      Returns:
      the optional
    • currentTimeMillis

      protected long currentTimeMillis()
      Returns the current time millis of the system.
      Returns:
      the current time millis of the system