aws-cli
aws-cli copied to clipboard
Structured Error Output
Issue #, if available: CLI-5136 & CLI-7572 & https://github.com/aws/aws-cli/issues/2688
Description of changes:
Exposes modeled error members from AWS service exceptions to stdout in the configured output format (json/yaml/text/table/off), while maintaining the existing formatted error message on stderr.
Behavior:
Command: aws s3api get-object --bucket not-a-real-bucket-0000 --key file.txt out.txt
Before:
An error occurred (NoSuchBucket) when calling the GetObject operation: The specified bucket does not exist
After (stdout):
{
"Code": "NoSuchBucket",
"Message": "The specified bucket does not exist",
"BucketName": "not-a-real-bucket-0000"
}
After (stderr):
An error occurred (NoSuchBucket) when calling the GetObject operation: The specified bucket does not exist
Configuration:
Users can opt out via:
- Config:
cli_error_format = LEGACY - Environment:
AWS_CLI_ERROR_FORMAT=LEGACY
Additional Changes:
- Added
offas a valid output format option to suppress all output
Description of tests:
- Unit and functional tests pass locally.