feign icon indicating copy to clipboard operation
feign copied to clipboard

ErrorDecoder not invoked when Apache Http client throws checked exception

Open tszlek-equinix opened this issue 3 years ago • 5 comments

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.

tszlek-equinix avatar Aug 17 '21 14:08 tszlek-equinix

@kdavisk6 Hi, 👋 can I give it a try in the scope of Hacktoberfest? Could you assign it to me?

gitaroktato avatar Oct 18 '21 11:10 gitaroktato

Absolutely @gitaroktato go for it

velo avatar Oct 18 '21 18:10 velo

@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.

gitaroktato avatar Oct 22 '21 09:10 gitaroktato