mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
use proper error codes
This commit is contained in:
parent
28b46a1e5b
commit
565fdb0f8c
@ -115,13 +115,13 @@ export class Decryption {
|
|||||||
try {
|
try {
|
||||||
payload = JSON.parse(plaintext);
|
payload = JSON.parse(plaintext);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new DecryptionError("Could not JSON decode plaintext", event, {plaintext, err});
|
throw new DecryptionError("NOT_JSON", event, {plaintext, err});
|
||||||
}
|
}
|
||||||
this._validatePayload(payload, event);
|
this._validatePayload(payload, event);
|
||||||
return {event: payload, senderKey};
|
return {event: payload, senderKey};
|
||||||
} else {
|
} else {
|
||||||
throw new DecryptionError("Didn't find any session to decrypt with", event,
|
throw new DecryptionError("OLM_NO_MATCHING_SESSION", event,
|
||||||
{sessionIds: senderKeyDecryption.sessions.map(s => s.id)});
|
{knownSessionIds: senderKeyDecryption.sessions.map(s => s.id)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user