1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-07 05:22:15 +03:00

Fix logging of DecryptionErrors to be more useful

We were relying on being able to override toString in DecryptionError, which
(a) doesn't work thanks to https://github.com/babel/babel/issues/3083, and (b)
was a bit naughty anyway. Instead, just add a detailedString property and use
that.
This commit is contained in:
Richard van der Hoff
2017-11-22 14:42:32 +00:00
parent c31ce641a1
commit c80bde1f60
2 changed files with 18 additions and 23 deletions

View File

@@ -424,7 +424,7 @@ utils.extend(module.exports.MatrixEvent.prototype, {
// decryption error, but we have a retry queued.
console.log(
`Got error decrypting event (id=${this.getId()}: ` +
`${e.message}), but retrying`,
`${e}), but retrying`,
);
continue;
}
@@ -432,7 +432,7 @@ utils.extend(module.exports.MatrixEvent.prototype, {
// decryption error, no retries queued. Warn about the error and
// set it to m.bad.encrypted.
console.warn(
`Error decrypting event (id=${this.getId()}): ${e}`,
`Error decrypting event (id=${this.getId()}): ${e.detailedString}`,
);
res = this._badEncryptedMessage(e.message);