File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
src/ModelContextProtocol.Core/Client Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -57,20 +57,15 @@ public static async Task<McpClient> CreateAsync(
5757 // ConnectAsync already disposed the session (which includes awaiting Completion).
5858 // Check if the transport provided structured completion details indicating
5959 // why the transport closed that aren't already in the original exception chain.
60- ClientCompletionDetails ? completionDetails = null ;
61- try
62- {
63- completionDetails = await clientSession . Completion . ConfigureAwait ( false ) ;
64- }
65- catch { } // allow the original exception to propagate if completion is unavailable
60+ var completionDetails = await clientSession . Completion . ConfigureAwait ( false ) ;
6661
6762 // If the transport closed with a non-graceful error (e.g., server process exited)
6863 // and the completion details carry an exception that's NOT already in the original
6964 // exception chain, throw a TransportClosedException with the structured details so
7065 // callers can programmatically inspect the closure reason (exit code, stderr, etc.).
7166 // When the same exception is already in the chain (e.g., HttpRequestException from
7267 // an HTTP transport), the original exception is more appropriate to re-throw.
73- if ( completionDetails ? . Exception is { } detailsException &&
68+ if ( completionDetails . Exception is { } detailsException &&
7469 ! ExceptionChainContains ( ex , detailsException ) )
7570 {
7671 throw new TransportClosedException ( completionDetails ) ;
You can’t perform that action at this time.
0 commit comments