Skip to content

Commit b597ecb

Browse files
fix swallowing errors
1 parent 679017d commit b597ecb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/mcp/client/session.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ async def __call__(
5757
async def _default_message_handler(
5858
message: RequestResponder[types.ServerRequest, types.ClientResult] | types.ServerNotification | Exception,
5959
) -> None:
60+
if isinstance(message, Exception):
61+
# Re-raise exceptions so they propagate back to the application
62+
raise message
6063
await anyio.lowlevel.checkpoint()
6164

6265

0 commit comments

Comments
 (0)