awslabs / aws-crt-python

Python bindings for the AWS Common Runtime
Apache License 2.0
87 stars 43 forks source link

S3ResponseError #522

Closed graebm closed 10 months ago

graebm commented 10 months ago

Issue: The exceptions delivered from the S3Client were lacking information like the HTTP response code, headers, & body. You could get the extra information from the on_done callback, but it would be nice to get it from the exception, so you could use the request.finished_future instead of the on_done callback if you wanted.

Description of changes: Add new error type: awscrt.s3.S3ResponseError, which inherits from awscrt.exceptions.AwsCrtError. If we have information about the failed request, then use an S3ResponseError instead.

Debatable:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.