-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Handles message type Exception in lowlevel/server.py _handle_message function. Mentioned as TODO on line 528. #786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@Kludex I came across TODO mentioned in Would appreciate feedback on how to handle the exception. Since there is no request attached to the message I have sent a log notification response to the client with the error message. |
- Handle exceptions in match statement as suggested by TODO - Use proper dict structure for error logging instead of ErrorData - Add comprehensive tests with parameterization - Include exception type, module, and args in log data Reported-by: AishwaryaKalloli Github-Issue: modelcontextprotocol#786
- Handle exceptions in match statement as suggested by TODO - Use proper dict structure for error logging instead of ErrorData - Add comprehensive tests with parameterization - Include exception type, module, and args in log data Reported-by: AishwaryaKalloli Github-Issue: #786
@AishwaryaKalloli thanks for your contribution! Made some tweaks on top of your branch + rebased + added some test cases for exception handling. I don't think we should be using JSONRPC types for log messages, so changed this to a literal dict. |
…-h5-and-h6-styles-globally Apply `h5` and `h6` styles to all content
Initital commit, need feedback.
- Handle exceptions in match statement as suggested by TODO - Use proper dict structure for error logging instead of ErrorData - Add comprehensive tests with parameterization - Include exception type, module, and args in log data Reported-by: AishwaryaKalloli Github-Issue: modelcontextprotocol#786
Changed exception data format to match Python's __exit__ format: - exception_type: The exception class name - exception_value: The exception message/value - exception_traceback: The traceback (set to None for now) Updated tests to verify the new data format.
Added proper type hints for parametrized test function parameters to resolve pyright errors.
Use modern type[Exception] annotation instead of deprecated typing.Type.
@Kludex ready for another look |
Handles message type Exception in lowlevel/server.py _handle_message function.
Right now I am sending a error log if parameter raise_exception=False.
Initital commit, need feedback.
Motivation and Context
Addressing a TODO mentioned in the code, handling one of the unhandled types of message in server.
How Has This Been Tested?
Initial commit, testing pending, need feedback to move ahead.
Breaking Changes
Does not break existing flow. Since the method raises exception it will break the code in case of exception, however it is expected behaviour.
Types of changes
Checklist
Additional context