Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/a2a/utils/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ def __init__(

Args:
error: The specific A2A or JSON-RPC error model instance.
If None, an `InternalError` will be used when formatting the response.
"""
self.error = error

def __str__(self) -> str:
"""Returns a readable representation of the internal Pydantic error."""
if self.error is None:
return 'None'
if self.error.message is None:
return self.error.__class__.__name__
return self.error.message

def __repr__(self) -> str:
"""Returns an unambiguous representation for developers showing how the ServerError was constructed with the internal Pydantic error."""
return f'{self.__class__.__name__}({self.error!r})'
Loading