fix: Add constructor for McpError to allow setting field

Backport of #116 by @allenporter to v1.1.x branch.

Fixes an issue where exception handling code fails with AttributeError
when accessing the error field of McpError.
This commit is contained in:
Allen Porter 2025-01-02 09:30:18 +00:00 • committed by David Soria Parra
commit b89cabc7df
No known key found for this signature in database

View file

@ -7,3 +7,8 @@ class McpError(Exception):
"""
error: ErrorData
def __init__(self, error: ErrorData):
"""Initialize McpError."""
super().__init__(error.message)
self.error = error