| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
- Add missing Exception case in _handle_message match statement - Use logger.exception() following CLAUDE.md guidelines - Respect raise_exceptions parameter for backward compatibility - Add comprehensive tests for exception handling scenarios - Remove TODO comment as issue is resolved This fixes a critical gap where Exception instances passed to _handle_message were not properly handled, potentially causing silent failures in production.
|
Closing this PR as this is a duplicate of #786 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fix: Handle Exception case in lowlevel server _handle_message
Problem
The _handle_message method in src/mcp/server/lowlevel/server.py had a critical unhandled case for Exception types. Despite the function signature explicitly accepting Exception as a valid message type, the match statement was missing this case, potentially leading to silent failures in production environments.
Critical TODO was present:
Solution
🔧 Fixed the unhandled Exception case by:
Added proper Exception handling in the match statement:
Removed the TODO comment and type ignore directive as the issue is now resolved
Added comprehensive test coverage in tests/server/test_exception_handling.py:
Files Changed
Commit Info
Reviewers: @jerome3o-anthropic @jspahrsummers
This PR resolves the most critical outstanding TODO in the codebase and significantly improves the robustness of the MCP server implementation.