-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Inconsistent ResponseStatus and ErrorMessage in case of timeout #2257
Comments
There's no exception from HttpClient being produced in case of time outs because RestSharp uses a cancellation token source with a given delay to control the maximum request duration. HttpClient timeout exception is only produced when an external HttpClient instance is used instead of the default one created by The |
Hm... Let's make sure that I fully understand your point.
The first two are connected directly as Ideally we want that all 3 of these properties to be in sync and also describe the state as more accurately as possible. For now, in the case of the timeout, we have
And if we will fix only the Is it correct? I also checked the implementation of the
Maybe RestSharp can implement something similar with a exception wrapping? In this case we will have:
I'm not familiar with RestSharp internals and public API contracts, so I can't say for sure about the possible side effects of such a fix. It might be that the game is not worth the candle. |
Yeah, I actually agree that it makes sense, I just worry that there's some existing code out there that relies on the current behaviour. I'd like to keep the issue open, and consider it for the next major version. |
Describe the bug
When the request is timed out,
RepsonseStatus
becomesTimedOut
, butErrorMessage
becomes “A task was canceled”, which is a bit contradictory.To Reproduce
Code
Expected behavior
The
ErrorMessage
should tell us about the timeout I guess, to be consistent with the status and real situation (no cancellation was requested from user). For example, in the RestSharp 106 the message was "The operation has timed out." or "The request timed-out." depending on where the timeout was set (on theRestClient
orRestResponse
, respectively). As an alternative the full error message from the innerHttpClient
may be used. It looks like this: "The request was canceled due to the configured HttpClient.Timeout of 0,001 seconds elapsing." and also describes the situation in non-confusing way.Stack trace
No exception.
Desktop (please complete the following information):
Additional context
none
The text was updated successfully, but these errors were encountered: