Replies: 3 comments 4 replies
-
Oh I get it. So close... pub async fn get_object(&self, bucket: &str, key: &str) -> Result<Bytes> {
let resp = self
.client
.get_object()
.bucket(bucket)
.key(key)
.send()
.await
.map_err(aws_sdk_s3::Error::from);
match &resp {
Err(aws_sdk_s3::Error::NoSuchKey(_)) => {
warn!(
"Failed to get s3://{}/{}: (NoSuchKey). Skipping.",
bucket, key
);
}
_ => {}
};
let resp = resp?;
let content = resp.body.collect().await?.into_bytes();
anyhow::Ok(content)
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm here again... How do I catch 429 TooManyRequests? After mapping to {:#} meta {:?} message {:?} gives unhandled error meta ErrorMetadata { code: None, message: None, extras: None } |
Beta Was this translation helpful? Give feedback.
2 replies
-
It seems like we need |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm implementing a simple flow of getting an object, and checking its errors - if it's a
NoSuchKey
, we log it one way and do something, and if it's a different variant, we log and do some other thing.I'm having a hard time doing this beyond the suggested way (went through a few discussions/issues/Google searches):
This works. However, sometimes I don't want to consume the
resp
. I would like to be able to take a reference ofresp: Result<GetObjectOutput, SdkError<...,...>>
and do error parsing without worrying about moving or reconstructing theresp
.The
SdkError
is not clone-able. It'sinto_service_error()
also moves.Beta Was this translation helpful? Give feedback.
All reactions