feign
feign copied to clipboard
ErrorDecoder not invoked when Apache Http client throws checked exception
Hi, I have discovered issue when using feign.httpclient.ApacheHttpClient
.
In some cases Apache client throws ProtocolException
which is a checked exception. This happens for example when server returned 303 HTTP code but there was no location header.
In such case Feign proxy throws UndeclaredThrowableException
instead of invoking ErrorDecoder.
@kdavisk6 Hi, 👋 can I give it a try in the scope of Hacktoberfest? Could you assign it to me?
Absolutely @gitaroktato go for it
@kdavisk6 I have two alternatives for solving the issue:
- https://github.com/gitaroktato/feign/commit/868e2a150f0911bb074d9071a88fadb210c2e44a
- https://github.com/gitaroktato/feign/commit/62540165b4efaf6543697ea7e5528989d8810d64
Could you take a brief look and suggest which one aligns better with the existing design? The main problem is that the root cause of the HTTP protocol error is in the thrown exception's stack trace. So it's required for someone who would like to understand what was the issue. If I use the original ErrorDecoder's interface then this information is lost, because it's receiving the response instead of the exception.