Skip to content

fix: chain exceptions with 'from' in 4 missed raise sites#2576

Open
siddhirajkatkar wants to merge 1 commit into
modelcontextprotocol:mainfrom
siddhirajkatkar:fix/exception-chain-missed-sites
Open

fix: chain exceptions with 'from' in 4 missed raise sites#2576
siddhirajkatkar wants to merge 1 commit into
modelcontextprotocol:mainfrom
siddhirajkatkar:fix/exception-chain-missed-sites

Conversation

@siddhirajkatkar
Copy link
Copy Markdown

Closes #2575

Follow-up to #2564 which fixed 12 sites. These 4 were missed:

File Line Fix
server/mcpserver/resources/templates.py 133 from e
shared/experimental/tasks/in_memory_task_store.py 172 from None
server/mcpserver/prompts/base.py 184 from None
server/mcpserver/prompts/base.py 189 from e

Without from, Python shows "During handling of the above exception,
another exception occurred" instead of "The above exception was the
direct cause". Callers cannot inspect __cause__ programmatically.

Follow-up to modelcontextprotocol#2564 which fixed 12 sites. These 4 were missed:
- resources/templates.py: add 'from e' to preserve exception chain
- in_memory_task_store.py: add 'from None' (same type, better message)
- prompts/base.py: add 'from None' and 'from e' to two raise sites
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 4 additional raise sites missing exception chaining with 'from'

2 participants