Fallback service is wrapping ProductNotFoundException into HystrixRunTimeException. I want to propagate custom exception as it is instead of wrapping into HystrixRunTimeException. Below is the code snippet for reference:
@FeignClient(name = "service1", fallback = FallBackService1.class )
public interface FeignService1{
String validateProducts(Product product);
}
class FallBackService1 implements FeignService1{
@override
public String validateProducts(Product product){
throw new ProductNotFoundException("P119","Product not found");
}
}
I have enabled feign.hystrix.enable = true.
Please help with this. I want to propagate the exception as it is. I do not want it to be wrapped.