-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
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
@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.gg |
"message": str(message), | ||
"type": type(message).__name__, | ||
"module": type(message).__module__, | ||
"args": getattr(message, "args", None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we instead pass the values that would be passed to __exit__
?
exception_type, exception_value, exception_traceback
I'm assuming passing the data in this shape was your idea? Or do we do this somewhere else already?
…-h5-and-h6-styles-globally Apply `h5` and `h6` styles to all content
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