Skip to content

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

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

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
Contributor

Closes#2575

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

FileLineFix
server/mcpserver/resources/templates.py133from e
shared/experimental/tasks/in_memory_task_store.py172from None
server/mcpserver/prompts/base.py184from None
server/mcpserver/prompts/base.py189from 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
@siddhirajkatkar
siddhirajkatkarforce-pushed the fix/exception-chain-missed-sites branch from 924efcf to c8e7562CompareMay 12, 2026 16:09
@maxisbey

Copy link
Copy Markdown
Contributor

Closing as a duplicate of #2565, which already covers three of these four sites (and was opened first). The one new site (in_memory_task_store.py) is worth folding into #2565. Thanks for the contribution.

AI Disclaimer

@siddhirajkatkar

Copy link
Copy Markdown
ContributorAuthor

"Happy to help with testing or review if needed."

Sign up for freeto 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

@siddhirajkatkar@maxisbey