Skip to content

Commit

Permalink
Missed a couple
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti committed Nov 15, 2022
1 parent 13b938c commit 98d3b97
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rust-runtime/aws-smithy-json/src/deserialize/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ pub fn expect_number_or_null(
/// Expects a [Token::ValueString] or [Token::ValueNull]. If the value is a string, it interprets it as a base64 encoded [Blob] value.
pub fn expect_blob_or_null(token: Option<Result<Token<'_>, Error>>) -> Result<Option<Blob>, Error> {
Ok(match expect_string_or_null(token)? {
Some(value) => Some(Blob::new(base64::decode(value.as_escaped_str()).map_err(
|err| Error::custom(format!("failed to decode base64: {}", err)),
)?)),
Some(value) => Some(Blob::new(
base64::decode(value.as_escaped_str())
.map_err(|err| Error::custom_source("failed to decode base64", err))?,
)),
None => None,
})
}
Expand Down Expand Up @@ -218,7 +219,7 @@ pub fn expect_timestamp_or_null(
Format::DateTime | Format::HttpDate => expect_string_or_null(token)?
.map(|v| DateTime::from_str(v.as_escaped_str(), timestamp_format))
.transpose()
.map_err(|err| Error::custom(format!("failed to parse timestamp: {}", err)))?,
.map_err(|err| Error::custom_source("failed to parse timestamp", err))?,
})
}

Expand Down

0 comments on commit 98d3b97

Please sign in to comment.