OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.49k stars 1.93k forks source link

ErrorDecoder not invoked when Apache Http client throws checked exception #1487

Open tszlek-equinix opened 3 years ago

tszlek-equinix commented 3 years ago

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.

gitaroktato commented 3 years ago

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

velo commented 3 years ago

Absolutely @gitaroktato go for it

gitaroktato commented 3 years ago

@kdavisk6 I have two alternatives for solving the issue:

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.

Vaibhav-tech22 commented 3 months ago

Hey @velo, is this issue closed. If not I would like to give it a try

velo commented 3 months ago

Still needs work.

Probably some tests showing the issue and handling the exception at Client code