Merge branch 'krille/olmerrorhandling' into 'main'
change: Olm exception handling See merge request famedly/famedlysdk!633
This commit is contained in:
commit
650484c306
|
|
@ -392,7 +392,8 @@ class DecryptException implements Exception {
|
||||||
DecryptException(this.cause, [this.libolmMessage]);
|
DecryptException(this.cause, [this.libolmMessage]);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => cause;
|
String toString() =>
|
||||||
|
cause + (libolmMessage != null ? ': $libolmMessage' : '');
|
||||||
|
|
||||||
static const String notEnabled = 'Encryption is not enabled in your client.';
|
static const String notEnabled = 'Encryption is not enabled in your client.';
|
||||||
static const String unknownAlgorithm = 'Unknown encryption algorithm.';
|
static const String unknownAlgorithm = 'Unknown encryption algorithm.';
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,7 @@ class OlmManager {
|
||||||
try {
|
try {
|
||||||
plaintext = session.session.decrypt(type, body);
|
plaintext = session.session.decrypt(type, body);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// The message was encrypted during this session, but is unable to decrypt
|
||||||
throw DecryptException(
|
throw DecryptException(
|
||||||
DecryptException.decryptionFailed, e.toString());
|
DecryptException.decryptionFailed, e.toString());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue