aws-sdk-rust icon indicating copy to clipboard operation
aws-sdk-rust copied to clipboard

aws-sdk-s3 - re-export aws_smithy_http::byte_stream::Error

Open jeremychone opened this issue 2 years ago • 3 comments

Describe the feature

In the s3/src/lib.rs, it would be great to add aws_smithy_http::byte_stream::Error to the list of re-exported types.

This is probably a low priority and more convenient as a workable solution exists.

Use Case

When using AWS S3 SDK and wanting to write error convertors to S3-related Errors, we can do most of them, except the aws_smithy_http::byte_stream::Error since it is not re-exported from the S3 SDK.

The simple workaround is to add aws_smithy_http to the Cargo.toml, which might create lib out-of-sync issues at compile time.

Having one place to import all of those relevant to AWS S3 SDK errors will remove this little friction.

Proposed Solution

In s3/src/lib.rs add to the types submodule:

pub mod types {
    pub use aws_smithy_http::byte_stream::Error; // <<-- new line
    // ...
}

Other Information

I just hit an error today when I upgraded all my dependencies, and when I upgraded aws-smithy-http to 0.47.0 it caused some compiler issues.

Now, there might be a good reason why this should not be done, and if it is the case, feel free to disregard this feature request.

Acknowledgements

  • [X] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

A note for the community

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue, please leave a comment

jeremychone avatar Aug 06 '22 21:08 jeremychone

We probably need to either:

  • Switch to re-exporting the bytestream module
  • re-export it with a rename eg. ByteStreamError

It's probably a little misleading for types::Error to actually be a ByteStream error. Definitely agree that this would be nice to fix though

rcoh avatar Aug 08 '22 15:08 rcoh

Funny enough I just came here to open a similar issue. Would it be possible to just rexport all of aws-smithy-http? I'm not sure the implications of this, but I have test code that looks something like:

fn make_http_response(status: http::StatusCode) -> SdkError<GetObjectError> {
  SdkError::ServiceError {
    err: GetObjectError::unhandled(error::Error::AwsSdk("fake".to_string())),
    raw: aws_smithy_http::operation::Response::new(
      http::Response::builder()
        .status(status)
        .body(aws_smithy_http::body::SdkBody::empty())
        .unwrap(),
    ),
  }
}

And I keep getting errors when aws_smithy_http gets bumped without the SDK getting bumped. Is there a better way to do what I'm trying to do?

mattklein123 avatar Aug 08 '22 16:08 mattklein123

@mattklein123 - Thank you for the code snippet. That's very informative for what we should be re-exporting.

Tracking implementation of this in smithy-rs#1759.

jdisanti avatar Sep 30 '22 18:09 jdisanti

Fix released in https://github.com/awslabs/aws-sdk-rust/releases/tag/release-2023-03-30.

ysaito1001 avatar Mar 31 '23 01:03 ysaito1001

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Mar 31 '23 01:03 github-actions[bot]