[System.Net.Http] Wrap certain exceptions into HttpRequestException. Fixes #44978
authorMarek Safar <marek.safar@gmail.com>
Wed, 5 Oct 2016 15:55:33 +0000 (17:55 +0200)
committerMarek Safar <marek.safar@gmail.com>
Wed, 5 Oct 2016 15:56:56 +0000 (17:56 +0200)
mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs

index 78f2fafcc83284e5e87abfbcbfb13e4935abbd1a..a3335ea5506ffe67aafedba5773301d48b9cee77 100644 (file)
@@ -380,7 +380,9 @@ namespace System.Net.Http
                                }
                        } catch (WebException we) {
                                if (we.Status != WebExceptionStatus.RequestCanceled)
-                                       throw;
+                                       throw new HttpRequestException ("An error occurred while sending the request", we);
+                       } catch (System.IO.IOException ex) {
+                               throw new HttpRequestException ("An error occurred while sending the request", ex);
                        }
 
                        if (cancellationToken.IsCancellationRequested) {