-
-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "e is undefined" masking the original error in MegolmDecryption #847
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is anything throwing undefined
? 😮
Looks reasonable, though I don't know how much good it will do, given that if e
is undefined, then there isn't really an "original error" that we can get any useful information from. On the other hand, it surely can't hurt, so 👍 .
src/crypto/algorithms/megolm.js
Outdated
@@ -758,15 +758,15 @@ MegolmDecryption.prototype.decryptEvent = async function(event) { | |||
} catch (e) { | |||
let errorCode = "OLM_DECRYPT_GROUP_MESSAGE_ERROR"; | |||
|
|||
if (e.message === 'OLM.UNKNOWN_MESSAGE_INDEX') { | |||
if (e && e.message && e.message === 'OLM.UNKNOWN_MESSAGE_INDEX') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only e && e.message === 'OLM.UNKNOWN_MESSAGE_INDEX'
is required, since if e.message
is falsy, then it won't equal to OLM.UNKNOWN_MESSAGE_INDEX
.
Good point - if we're getting undefined then something else is horribly wrong. At least this should (hopefully) make it a bit clearer though, even if it is just reducing the noise in the logs. |
Could be https://github.com/matrix-org/matrix-js-sdk/blob/master/src/crypto/store/indexeddb-crypto-store-backend.js#L697 We should probably take the same approach as in the other idb store? |
@bwindels good catch. I don't know why it different, but certainly the |
Someone with a bit of knowledge around the state machine for encryption probably wants to review this.