From 89813f669ad5b5daf76119e3e499f46ea4a8dcbd Mon Sep 17 00:00:00 2001 From: Mark Drobnak Date: Tue, 21 Jul 2020 09:12:15 -0400 Subject: [PATCH] Handle both serialization AND deserialization errors in DbClient --- autoendpoint/src/db/client.rs | 3 +-- autoendpoint/src/db/error.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/autoendpoint/src/db/client.rs b/autoendpoint/src/db/client.rs index f00b31f9f..4222d834d 100644 --- a/autoendpoint/src/db/client.rs +++ b/autoendpoint/src/db/client.rs @@ -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() }; diff --git a/autoendpoint/src/db/error.rs b/autoendpoint/src/db/error.rs index 8338d3f71..ddbfc5898 100644 --- a/autoendpoint/src/db/error.rs +++ b/autoendpoint/src/db/error.rs @@ -19,6 +19,6 @@ pub enum DbError { #[error("Database error while performing DeleteItem")] DeleteItem(#[from] RusotoError), - #[error("Error while deserializing database response: {0}")] - Deserialize(#[from] serde_dynamodb::Error), + #[error("Error while performing (de)serialization: {0}")] + Serialization(#[from] serde_dynamodb::Error), }