There was an error while loading. Please reload this page.
__str__
__repr__
ServerError
1 parent de376d0 commit 2c152c0Copy full SHA for 2c152c0
src/a2a/utils/errors.py
@@ -66,6 +66,17 @@ def __init__(
66
67
Args:
68
error: The specific A2A or JSON-RPC error model instance.
69
- If None, an `InternalError` will be used when formatting the response.
70
"""
71
self.error = error
+
72
+ def __str__(self) -> str:
73
+ """Returns a readable representation of the internal Pydantic error."""
74
+ if self.error is None:
75
+ return 'None'
76
+ if self.error.message is None:
77
+ return self.error.__class__.__name__
78
+ return self.error.message
79
80
+ def __repr__(self) -> str:
81
+ """Returns an unambiguous representation for developers showing how the ServerError was constructed with the internal Pydantic error."""
82
+ return f'{self.__class__.__name__}({self.error!r})'
0 commit comments