Improve exception diagnostics for stdio client (#376)
* Improve exception diagnostics for stdio client Track the last several lines of stderr and include those in an exception created as part of CleanupAsync if the server process has already exited. This is based on an assumption that the server should never exit prior to CleanupAsync being called. * Address feedback and fix test failure
This commit is contained in:
parent
8d4f51da50
commit
c11c634945
1 changed files with 222 additions and 131 deletions
|
|
@ -45,7 +45,7 @@ internal sealed partial class StreamableHttpClientSessionTransport : TransportBa
|
|||
// We connect with the initialization request with the MCP transport. This means that any errors won't be observed
|
||||
// until the first call to SendMessageAsync. Fortunately, that happens internally in McpClientFactory.ConnectAsync
|
||||
// so we still throw any connection-related Exceptions from there and never expose a pre-connected client to the user.
|
||||
SetConnected(true);
|
||||
SetConnected();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
@ -139,7 +139,7 @@ internal sealed partial class StreamableHttpClientSessionTransport : TransportBa
|
|||
}
|
||||
finally
|
||||
{
|
||||
SetConnected(false);
|
||||
SetDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue