Skip to content
Snippets Groups Projects
Unverified Commit aa07854f authored by Zelda Hessler's avatar Zelda Hessler Committed by GitHub
Browse files

Fix S3 canary match statement (#2358)

* fix: s3 canary error match

* update: use Error.is_ to check for "no such key" error in canary

* remove: leftover import
parent 1d1e68ae
Branches
Tags
No related merge requests found
...@@ -8,7 +8,6 @@ use crate::{mk_canary, CanaryEnv}; ...@@ -8,7 +8,6 @@ use crate::{mk_canary, CanaryEnv};
use anyhow::Context; use anyhow::Context;
use aws_config::SdkConfig; use aws_config::SdkConfig;
use aws_sdk_s3 as s3; use aws_sdk_s3 as s3;
use s3::error::GetObjectError;
use s3::types::ByteStream; use s3::types::ByteStream;
use uuid::Uuid; use uuid::Uuid;
...@@ -35,12 +34,13 @@ pub async fn s3_canary(client: s3::Client, s3_bucket_name: String) -> anyhow::Re ...@@ -35,12 +34,13 @@ pub async fn s3_canary(client: s3::Client, s3_bucket_name: String) -> anyhow::Re
CanaryError(format!("Expected object {} to not exist in S3", test_key)).into(), CanaryError(format!("Expected object {} to not exist in S3", test_key)).into(),
); );
} }
Err(err) => match err.into_service_error() { Err(err) => {
GetObjectError::NoSuchKey(..) => { let err = err.into_service_error();
// good // If we get anything other than "No such key", we have a problem
if !err.is_no_such_key() {
return Err(err).context("unexpected s3::GetObject failure");
}
} }
err => Err(err).context("unexpected s3::GetObject failure")?,
},
} }
// Put the test object // Put the test object
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment