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
I think it's inconsistent and confusing for the user as he or she can't rely on the same data-source for all exceptions. On the other hand, I'm not sure whether it's intentional as there are unit-tests that check this behaviour, thus changing it could also be breaking-change for users:
It is intentional. Feign Exception cannot depend on a Response being available when it is created or available since these exceptions can be thrown before and after a request. For example, when a request times out, a FeignException is created and there is no response. In order to provide additional context, we use the Request.
One thing we can do to clear up this potential confusion is to update the documentation and comment to code to make this intention clearer.
FixesOpenFeign#920
FeignException may contain the data from the response if the response is available and contains data. However, the method `content` is ambiguious and does not reveal it's intent. User's have expressed confusion as to if it is for the Request or the Response.
This change adds a new method `responseBody` to addresse this. Use of content is now `@deprecated`.
Fixes#920
FeignException may contain the data from the response if the response is available and contains data. However, the method `content` is ambiguious and does not reveal it's intent. User's have expressed confusion as to if it is for the Request or the Response.
This change adds a new method `responseBody` to addresse this. Use of content is now `@deprecated`.
While working on #912 I came across an odd behaviour:
In
errorStatus
aFeignException
is created with the response's body:feign/core/src/main/java/feign/FeignException.java
Line 81 in ce66205
In
errorReading
aFeignException
is created with the request's body (even though the response with its body would be at hand):feign/core/src/main/java/feign/FeignException.java
Line 72 in ce66205
I think it's inconsistent and confusing for the user as he or she can't rely on the same data-source for all exceptions. On the other hand, I'm not sure whether it's intentional as there are unit-tests that check this behaviour, thus changing it could also be breaking-change for users:
feign/core/src/test/java/feign/FeignTest.java
Line 525 in ce66205
If we agree on returning the response-body, I'd gladly create a PR for it.
The text was updated successfully, but these errors were encountered: