Fix all megolm error reported as unknown (#8916)

* Fix all megolm error reported as unknown

* code review

* bad paste in comment
This commit is contained in:
Valere 2022-06-30 09:55:05 +02:00 committed by GitHub
parent 4eab0deeb3
commit f137bf3fd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View file

@ -22,13 +22,16 @@ class MockDecryptionError extends Error {
constructor(code) {
super();
this.errcode = code || 'MOCK_DECRYPTION_ERROR';
this.code = code || 'MOCK_DECRYPTION_ERROR';
}
}
function createFailedDecryptionEvent() {
const event = new MatrixEvent({
event_id: "event-id-" + Math.random().toString(16).slice(2),
content: {
algorithm: "m.megolm.v1.aes-sha2",
},
});
event.setClearData(event.badEncryptedMessage(":("));
return event;