-
Notifications
You must be signed in to change notification settings - Fork 972
Don't use the value of AwsQueryError in json rpc/smithy-rpc-v2-cbor protocols #6642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
zoewangg
reviewed
Dec 23, 2025
...dwatch/src/it/java/software/amazon/awssdk/services/cloudwatch/CloudWatchIntegrationTest.java
Outdated
Show resolved
Hide resolved
…_type and code fields and handle uris in body error codes
S-Saranya1
approved these changes
Dec 23, 2025
zoewangg
approved these changes
Dec 23, 2025
|
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Don't use the value of AwsQueryError in json rpc/smithy-rpc-v2-cbor protocols
Motivation and Context
The AwsQueryError trait (in our C2J models,
error) MUST apply only to query and rest json/xml protocols. It MUST NOT be applied to json (rpc) and smithy-rpcv2-cbor protocols.Right now a json or smithy-rpcv2-cbor service with
errortraits will incorrectly deserialize all errors as generic service exceptions and NOT as the correct, modeled exception class.Modifications
errortrait before using it's value. Note: this changes only which exception class is used when deserializing errors. It does NOT change how the awsQueryCompatible trait is applied at runtime. That is done in the AwsJsonProtocolErrorUnmarshaller#getEffectiveErrorCode methodTesting
Added a new integration test + increased strictness of existing protocol tests.
Why is this change safe to make?
There are no existing json or smithy-rpcv2-cbor service models in the repo with the
errortrait - so this should not change the behavior of any current services.Note: this changes only which exception class is used when deserializing errors. It does NOT change how the awsQueryCompatible trait is applied at runtime. That is done in the AwsJsonProtocolErrorUnmarshaller#getEffectiveErrorCode method
Why did protocol tests not catch this?
Our protocol tests previously only checked that the deserialized error code (and other fields) on the exception were correct. They were NOT asserting that the class of the exception matched the expected class.
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License