-
-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: IsSuccessStatusCode is true, but Error is non-null #1694
Comments
We added this workaround extension method so we catch all errors when checking IApiResponse:
|
found the same too |
Many customers have reported this problem. I would be happy to help solving the issue. |
I think this is intentional, no? It would be strange if Instead I think public interface IApiResponse : IDisposable
{
...
public bool IsSuccess { get; }
...
}
public sealed class ApiResponse<T>
{
...
public bool IsSuccess => IsSuccessStatusCode && Error is null;
} |
Good idea @TimothyMakkison! If necessary, I can take care of such a PR. |
Thanks 😊, you're welcome to make a pr. Otherwise I'll get around to it tomorrow 😅 Might be worth updating the |
I'm sure @marcominerva will have care of the issue and submit the best PR to fix it, please Marco do it! |
@TimothyMakkison I have made the PR: #1891. I'm wondering if it's worth updating the documentation at https://github.com/reactiveui/refit#handling-exceptions. |
Yeah, good idea. I feel like most usage of On an related note do you prefer, |
I agree with you, so I have update the documentation.
After thinking about, probably |
Describe the bug 🐞
We noticed that if you get any serialization errors IsSuccessStatusCode is still true for ApiResponse, but Error is not-null because of error in serialization.
We have this reproducing code. Using xunit and RichardSzalay.MockHttp.
Step to reproduce
Create a class using this code and run the unit-test:
Reproduction repository
No response
Expected behavior
response.Error should not be null when IsSuccessStatusCode is true
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
No response
Device
No response
Refit Version
7.0.0
Additional information ℹ️
No response
The text was updated successfully, but these errors were encountered: