Commit cf4b3f23 authored by Amar Bogari's avatar Amar Bogari

condition added.

parent a8c26f2f
package com.nisum.offertransactionservice.config;
import feign.FeignException;
import feign.Request;
import feign.Response;
import feign.RetryableException;
import feign.codec.ErrorDecoder;
import org.springframework.http.HttpStatus;
import java.util.Date;
import java.util.Objects;
public class CustomErrorDecoder implements ErrorDecoder {
......@@ -17,8 +16,8 @@ public class CustomErrorDecoder implements ErrorDecoder {
public Exception decode(String methodKey, Response response) {
Exception exception = defaultErrorDecoder.decode(methodKey, response);
if(response.status() == HttpStatus.REQUEST_TIMEOUT.value()){
return new RetryableException(408,"408 error", response.request().httpMethod(), new Date(),response.request());
if( Objects.equals(response.status(),HttpStatus.REQUEST_TIMEOUT.value())){
return new RetryableException(HttpStatus.REQUEST_TIMEOUT.value(),"408 error", response.request().httpMethod(), new Date(),response.request());
}
return exception;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment