-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
WinHttpException should map to WebException Status #21447
Comments
We have thought about how to improve error handling in HttpClient. HttpWebRequest for example has WebException and WebExceptionStatus enums. This would something for a future release. HttpClient returns HttpRequestException's. We are thinking about adding a property to that except similar to WebExceptionStatus enum behavior. That is how we would handle cross-platform error codes. We would prefer to make the error handling just rely on a top-level exception property rather than have to use the inner exceptions. cc: @stephentoub |
This is really a dupe of #15567 |
Closing as duplicate of #15567. |
@DalSoft sorry for pinging you in this old discussion, but I wonder about your experience with .NET 5.0+ era error handling in |
The retry code in my RestClient covers all the cases I'm aware off. |
At the moment to handle transient exceptions cross platform, I'm having to do something special for .NET Standard Windows only (Map the NativeErrorCode to WebExceptionStatus). But for .NET 4.x and Mono I just get the WebExceptionStatus Status from the InnerException.
Here is how Mono does it for iOS
https://github.com/mono/mono/blob/master/mcs/class/System.Net.Http/HttpClientEx.cs
The text was updated successfully, but these errors were encountered: