Clean up (use of) McpException and McpTransportException (#321)
* Clean up (use of) McpException * Replace McpTransportException with InvalidOperationException * Add cancellation test
This commit is contained in:
parent
d65ddce268
commit
7d77be68cf
1 changed files with 231 additions and 219 deletions
|
|
@ -36,7 +36,7 @@ public static class McpServerExtensions
|
|||
|
||||
if (server.ClientCapabilities?.Sampling is null)
|
||||
{
|
||||
throw new ArgumentException("Client connected to the server does not support sampling.", nameof(server));
|
||||
throw new InvalidOperationException("Client does not support sampling.");
|
||||
}
|
||||
|
||||
return server.SendRequestAsync(
|
||||
|
|
@ -166,7 +166,7 @@ public static class McpServerExtensions
|
|||
|
||||
if (server.ClientCapabilities?.Sampling is null)
|
||||
{
|
||||
throw new ArgumentException("Client connected to the server does not support sampling.", nameof(server));
|
||||
throw new InvalidOperationException("Client does not support sampling.");
|
||||
}
|
||||
|
||||
return new SamplingChatClient(server);
|
||||
|
|
@ -204,7 +204,7 @@ public static class McpServerExtensions
|
|||
|
||||
if (server.ClientCapabilities?.Roots is null)
|
||||
{
|
||||
throw new ArgumentException("Client connected to the server does not support roots.", nameof(server));
|
||||
throw new InvalidOperationException("Client does not support roots.");
|
||||
}
|
||||
|
||||
return server.SendRequestAsync(
|
||||
|
|
|
|||
Loading…
Reference in a new issue