Improve HTTP2 connection diagnostics in SocketsHttpHandler (dotnet/corefx#35423)
authorDavid Shulman <david.shulman@microsoft.com>
Tue, 19 Feb 2019 22:33:43 +0000 (14:33 -0800)
committerStephen Toub <stoub@microsoft.com>
Tue, 19 Feb 2019 22:33:43 +0000 (17:33 -0500)
Modified the top-level exception being returned (HttpRequestException) to always include
the inner exception.

Contributes to dotnet/corefx#35422

Commit migrated from https://github.com/dotnet/corefx/commit/fcf46bea903c78accd9586fa2fb355ade70c485e

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs

index d2bd8ea..4a5244b 100644 (file)
@@ -1238,18 +1238,18 @@ namespace System.Net.Http
             {
                 http2Stream?.Dispose();
 
-                if (e is IOException ioe)
+                if (e is IOException)
                 {
-                    throw new HttpRequestException(SR.net_http_client_execution_error, ioe);
+                    throw new HttpRequestException(SR.net_http_client_execution_error, e);
                 }
                 else if (e is ObjectDisposedException)
                 {
-                    throw new HttpRequestException(SR.net_http_client_execution_error);
+                    throw new HttpRequestException(SR.net_http_client_execution_error, e);
                 }
                 else if (e is Http2ProtocolException)
                 {
                     // ISSUE 31315: Determine if/how to expose HTTP2 error codes
-                    throw new HttpRequestException(SR.net_http_client_execution_error);
+                    throw new HttpRequestException(SR.net_http_client_execution_error, e);
                 }
                 else
                 {