Skip to content

Commit

Permalink
rename error type
Browse files Browse the repository at this point in the history
  • Loading branch information
de-sh committed Dec 7, 2024
1 parent 54dc85f commit c9da598
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/storage/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub enum SSECEncryptionKey {
}

#[derive(Debug, thiserror::Error)]
pub enum Error {
pub enum SSEError {
#[error("Expected SSE-C:AES256:<base64_encryption_key>")]
UnexpectedKey,
#[error("Only SSE-C is supported for object encryption for now")]
Expand All @@ -167,16 +167,16 @@ pub enum Error {
}

impl FromStr for SSECEncryptionKey {
type Err = Error;
type Err = SSEError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
let parts = s.split(':').collect::<Vec<_>>();
if parts.len() != 3 {
return Err(Error::UnexpectedKey);
return Err(SSEError::UnexpectedKey);
}
let sse_type = parts[0];
if sse_type != "SSE-C" {
return Err(Error::UnexpectedProtocol);
return Err(SSEError::UnexpectedProtocol);
}

let algorithm = parts[1];
Expand All @@ -199,12 +199,12 @@ pub enum ObjectEncryptionAlgorithm {
}

impl FromStr for ObjectEncryptionAlgorithm {
type Err = Error;
type Err = SSEError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"AES256" => Ok(ObjectEncryptionAlgorithm::Aes256),
_ => Err(Error::InvalidAlgorithm),
_ => Err(SSEError::InvalidAlgorithm),
}
}
}
Expand Down

0 comments on commit c9da598

Please sign in to comment.