Repository navigation
fix(rest): find the A2A ErrorInfo anywhere in the error details - #1385
Merged
Merged
Conversation
RestErrorMapper read the reason only from the first entry of error.details. The HTTP+JSON binding allows other detail types, such as google.rpc.BadRequest, in any order, so an ErrorInfo after another detail was ignored and the error became a generic A2AClientHTTPError. Look for the ErrorInfo of the a2a-protocol.org domain in every detail, as GrpcErrorMapper does, and fall back to the first detail with a reason. Fixes a2aproject#1384
Collaborator
|
Retriggered the tests |
Collaborator
|
Thanks @suvvvv ! |
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.
Fixes #1384
RestErrorMappertook the errorreasonfrom the first entry oferror.detailsonly. The HTTP+JSON binding (§11.6) recommendsgoogle.rpc.BadRequestfor validation errors and allows further detail objects without fixing their order, so anErrorInfoafter another detail was ignored and the error became a genericA2AClientHTTPError. AnErrorInfoof another domain in first position was also taken as the A2A error.Change
extractReasonAndMetadatanow looks through every detail for thetype.googleapis.com/google.rpc.ErrorInfoof thea2a-protocol.orgdomain, asGrpcErrorMapper.extractErrorInfodoes. Without one it uses the first detail that has areason, so bodies without@typeordomain(as intestRecognizedA2AErrorDoesNotWrapInHttpError) are still mapped.Tests
New in
RestErrorMapperTest:BadRequestbefore the A2AErrorInfomaps toInvalidParamsError, with theErrorInfometadata as details.ErrorInfoof another domain before the A2A one maps toTaskNotCancelableError, notTaskNotFoundError.Both fail on
main. Dropping the domain check fails the second one, and dropping the fallback fails the existingtestRecognizedA2AErrorDoesNotWrapInHttpError.client/transport/rest: 80 tests pass, andspotless:checkis clean.