Skip to content

Commit

Permalink
Add error logs to S3 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
donaltuohy committed Aug 31, 2023
1 parent 0a9bed9 commit 166d525
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "storage-client-interface"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
license = "Apache-2.0"
description = "A Rust library for exposing the StorageClientInterface trait for interacting with a storage backend. Used by Evervault Cages."
Expand Down
11 changes: 9 additions & 2 deletions src/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl StorageClientInterface for StorageClient {
Err(err) => match err.into_service_error() {
GetObjectError::NoSuchKey(_) => return Ok(None),
err => {
println!("Error getting object from S3: {:?}", err);
return Err(StorageClientError::GetObject(err.to_string()));
}
},
Expand Down Expand Up @@ -96,7 +97,10 @@ impl StorageClientInterface for StorageClient {
.body(ByteStream::from(body_bytes))
.send()
.await
.map_err(ClientError::PutObject)?;
.map_err(|err| {
println!("Error puttin object to S3: {:?}", err);
ClientError::PutObject(err)
})?;

Ok(())
}
Expand All @@ -109,7 +113,10 @@ impl StorageClientInterface for StorageClient {
.key(key)
.send()
.await
.map_err(ClientError::DeleteObject)?;
.map_err(|err| {
println!("Error deleting object in S3: {:?}", err);
ClientError::DeleteObject(err)
})?;

Ok(())
}
Expand Down

0 comments on commit 166d525

Please sign in to comment.