Fix error classification using __cause__ instead of raised exception type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
William Easton 2026-03-27 18:31:05 -05:00
commit 59b19eb549
No known key found for this signature in database

View file

@ -89,7 +89,7 @@ class ErrorHandlingMiddleware(Middleware):
return error
# Map common exceptions to appropriate MCP error codes
error_type = type(error.__cause__) if error.__cause__ else type(error)
error_type = type(error)
if error_type in (ValueError, TypeError):
return McpError(