diff --git a/lib/encryption/encryption.dart b/lib/encryption/encryption.dart index 65992f3f..4a75f1dd 100644 --- a/lib/encryption/encryption.dart +++ b/lib/encryption/encryption.dart @@ -392,7 +392,8 @@ class DecryptException implements Exception { DecryptException(this.cause, [this.libolmMessage]); @override - String toString() => cause; + String toString() => + cause + (libolmMessage != null ? ': $libolmMessage' : ''); static const String notEnabled = 'Encryption is not enabled in your client.'; static const String unknownAlgorithm = 'Unknown encryption algorithm.'; diff --git a/lib/encryption/olm_manager.dart b/lib/encryption/olm_manager.dart index 592a6381..38db9325 100644 --- a/lib/encryption/olm_manager.dart +++ b/lib/encryption/olm_manager.dart @@ -305,6 +305,7 @@ class OlmManager { try { plaintext = session.session.decrypt(type, body); } catch (e) { + // The message was encrypted during this session, but is unable to decrypt throw DecryptException( DecryptException.decryptionFailed, e.toString()); }