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
parent 312e9da2dc
commit b89cabc7df

View File

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