From 00d1437e5ac9cb72ff17fb02cebe1b3f925e843d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 23 Jan 2023 10:59:14 +0100 Subject: [PATCH] chore(crypto): Log the full error messages when decrypting room events --- crates/matrix-sdk-crypto/src/error.rs | 2 +- crates/matrix-sdk-crypto/src/machine.rs | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/error.rs b/crates/matrix-sdk-crypto/src/error.rs index aa8f9ce81..ca07a696c 100644 --- a/crates/matrix-sdk-crypto/src/error.rs +++ b/crates/matrix-sdk-crypto/src/error.rs @@ -85,7 +85,7 @@ pub enum MegolmError { /// Decryption failed because we're missing the room key that was to encrypt /// the event. - #[error("decryption failed because the room key is missing")] + #[error("Can't find the room key to decrypt the event")] MissingRoomKey, /// The encrypted megolm message couldn't be decoded. diff --git a/crates/matrix-sdk-crypto/src/machine.rs b/crates/matrix-sdk-crypto/src/machine.rs index a569726d7..97db5b7a4 100644 --- a/crates/matrix-sdk-crypto/src/machine.rs +++ b/crates/matrix-sdk-crypto/src/machine.rs @@ -1190,17 +1190,13 @@ impl OlmMachine { match e { MegolmError::MissingRoomKey | MegolmError::Decryption(DecryptionError::UnknownMessageIndex(_, _)) => { - // TODO: log the withheld reason if we have one. - debug!( - "Failed to decrypt a room event, the room key is \ - missing or has been ratcheted" - ); self.key_request_machine.create_outgoing_key_request(room_id, &event).await?; } - _ => { - warn!("Failed to decrypt a room event: {e}"); - } + _ => {} } + + // TODO: log the withheld reason if we have one. + warn!("Failed to decrypt a room event: {e}"); } result