Skip to content

Conversation

@tzolov
Copy link
Contributor

@tzolov tzolov commented Nov 6, 2025

  • Improve McpClientSession error handling to preserve custom error codes and data from McpError instances.
  • Add aggregated exception messages to error data field for better debugging.
  • Include test coverage for various McpClientSession error scenarios.
- Improve McpClientSession error handling to preserve custom error codes
and data from McpError instances.
- Add aggregated exception messages to error data field for better debugging.
- Include test coverage for various McpClientSession error scenarios.

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov added this to the 0.16.0 milestone Nov 6, 2025
Copy link
Contributor

@Kehrlann Kehrlann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions for the tests

Comment on lines 190 to 191
transport = new MockMcpClientTransport();
session = new McpClientSession(TIMEOUT, transport, Map.of(testMethod, failingHandler), Map.of());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the transport from the class, and make a new session instance.

Suggested change
transport = new MockMcpClientTransport();
session = new McpClientSession(TIMEOUT, transport, Map.of(testMethod, failingHandler), Map.of());
var session = new McpClientSession(TIMEOUT, transport, Map.of(testMethod, failingHandler), Map.of());

Goes for all tests.

Comment on lines 272 to 273
@Test
void testRequestHandlerThrowsMcpErrorWithoutJsonRpcError() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggesting] remove this tests

Comment on lines 303 to 304
@Test
void testRequestHandlerThrowsResourceNotFoundError() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] remove this test, it's a special case of testRequestHandlerThrowsMcpErrorWithJsonRpcError

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov merged commit 476f9db into modelcontextprotocol:main Nov 7, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants