Repository navigation
fix(core): restore structured __repr__ on A2A exceptions - #1348
Open
cchinchilla-dev wants to merge 1 commit into
Open
cchinchilla-dev wants to merge 1 commit into
cchinchilla-dev wants to merge 1 commit into
Conversation
🧪 Code Coverage (vs
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
CONTRIBUTINGGuide.fix:which represents bug fixes, and correlates to a SemVer patch.feat:represents a new feature, and correlates to a SemVer minor.feat!:, orfix!:,refactor!:, etc., which represent a breaking change (indicated by the!) and will result in a SemVer major.bash scripts/format.shfrom the repository root to format)Fixes #1347 🦕
Problem
#683 added
__repr__methods to the client exception classes (#679). The client error refactor in #761 replaced those classes with theA2AError-based hierarchy, and the__repr__methods were not carried over. Both domain and client errors now fall back to the defaultException.__repr__, which only wrapsstr()output and loses structured attributes:Fix
Added
__repr__back, following the same pattern as #683:A2AError(src/a2a/utils/errors.py): Exposesmessageanddataas keyword arguments. All domain errors (TaskNotFoundError,InvalidParamsError, ...) and client errors (A2AClientError,A2AClientTimeoutError) inherit it.AgentCardResolutionError(src/a2a/client/errors.py): Exposesstatus_code, asA2AClientHTTPErrordid in #683.This change does not alter traceback formatting,
__str__output, exception hierarchy, catching behavior, or any existing error handling logic. It is purely additive and intended to improve debuggability viarepr()in REPLs, logs, and structured logging contexts.Test
Tests were added to the existing suite at
tests/client/test_errors.py, and to a newtests/utils/test_a2a_errors.pyforA2AErrorand domain errors (test_errors.pyis already taken by the client suite), keeping the same structure and conventions already in place.No existing test was modified or removed, all additions are purely additive. Happy to adapt the test approach based on maintainer feedback.