From 8b56546565f4cdeebfbab4f25f18f4772ba58ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 2 Sep 2020 12:17:38 +0200 Subject: [PATCH] crypto: Remove an unwrap from the sqlite cryptostore. --- matrix_sdk_crypto/src/store/mod.rs | 6 +++++- matrix_sdk_crypto/src/store/sqlite.rs | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/matrix_sdk_crypto/src/store/mod.rs b/matrix_sdk_crypto/src/store/mod.rs index 3e66661c..edd044cb 100644 --- a/matrix_sdk_crypto/src/store/mod.rs +++ b/matrix_sdk_crypto/src/store/mod.rs @@ -15,7 +15,7 @@ use std::{collections::HashSet, fmt::Debug, io::Error as IoError, sync::Arc}; use matrix_sdk_common::{ - identifiers::{DeviceId, RoomId, UserId}, + identifiers::{DeviceId, Error as IdentifierValidationError, RoomId, UserId}, locks::Mutex, }; use matrix_sdk_common_macros::async_trait; @@ -81,6 +81,10 @@ pub enum CryptoStoreError { #[error(transparent)] SessionUnpickling(#[from] SessionUnpicklingError), + /// A Matirx identifier failed to be validated. + #[error(transparent)] + IdentifierValidation(#[from] IdentifierValidationError), + /// The store failed to (de)serialize a data type. #[error(transparent)] Serialization(#[from] SerdeError), diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index e07f04cc..b3f567c2 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -398,8 +398,7 @@ impl SqliteStore { pickle: InboundGroupSessionPickle::from(pickle), sender_key, signing_key, - // FIXME remove this unwrap. - room_id: RoomId::try_from(room_id).unwrap(), + room_id: RoomId::try_from(room_id)?, }; Ok(InboundGroupSession::from_pickle(