You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's one part in the exception generator that I'm not terribly proud of:
private Object resolveBody(Response response) {
if (bodyType instanceof Class<?> && ((Class<?>) bodyType).isInstance(response)) {
return response;
}
try {
return bodyDecoder.decode(response, bodyType);
} catch (IOException e) {
// How do we log this?
return null;
} catch (DecodeException e) {
// How do we log this?
return null;
}
}
you see that it basically tries its best to decode the body, but if it fails, it actually does so silently (yuck).
That said - Feign itself doesn't decide on a logger for you... which begs the question: how to best log?
I expect that ErrorResponse is likely being returned in a format you don't expect or that your POJO doesn't fit to. You can perhaps debug by having the constructor just take feign.Response and capture the body/decode it yourself just to see what is happening.
The other option is a little more intrusive (Support some form of logging - while still not trying to be opinionated - much like what Feign itself tries to do). If you have a proposal (maybe we include a Logger class/object that logs the error, and if available, the body or so) then I'll be happy to implement it (or even, if you are up for it, have you implement it and I'll review).
I am trying to decode error response body but got always
null
:code specific
ErrorCodes
error Exception classes are generated properly but with empty body:Feign
'sOkHttp
client is used.Where is my bad?
Used versions:
Feign
:10.2.3
annotatiion-error-decoder
:1.2.0
P.S. Another developers from UA reported
feign-error-decoder
does not work properly.See also my question in chat.
The text was updated successfully, but these errors were encountered: