Skip to content

Commit

Permalink
Handle both serialization AND deserialization errors in DbClient
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureMarker committed Jul 21, 2020
1 parent a5bf7a8 commit a11591b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions autoendpoint/src/db/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ impl DbClient {
/// Store a single message
pub async fn store_message(&self, uaid: Uuid, message: Notification) -> DbResult<()> {
let put_item = PutItemInput {
item: serde_dynamodb::to_hashmap(&DynamoDbNotification::from_notif(&uaid, message))
.unwrap(),
item: serde_dynamodb::to_hashmap(&DynamoDbNotification::from_notif(&uaid, message))?,
table_name: self.message_table.clone(),
..Default::default()
};
Expand Down
4 changes: 2 additions & 2 deletions autoendpoint/src/db/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ pub enum DbError {
#[error("Database error while performing DeleteItem")]
DeleteItem(#[from] RusotoError<DeleteItemError>),

#[error("Error while deserializing database response: {0}")]
Deserialize(#[from] serde_dynamodb::Error),
#[error("Error while performing (de)serialization: {0}")]
Serialization(#[from] serde_dynamodb::Error),
}

0 comments on commit a11591b

Please sign in to comment.