1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

crypto/algorithms/base.js: Convert to es6

Convert base to an es6 module with es6 classes, for clarity and to help with
jsdoccing.

Complications are:

* jsdoc gets confused by `export class`, so the exports are separated.

* turns out that extending Error is a bit difficult, so instanceof doesn't work
  on derived Error classes. This only really affects us in one place (app-side
  code shouldn't be doing instanceofs anyway), so just use `name` instead.
This commit is contained in:
Richard van der Hoff
2017-05-23 14:32:13 +01:00
parent 0945ba9e90
commit b26c1c57dc
3 changed files with 113 additions and 120 deletions

View File

@@ -567,7 +567,7 @@ function _decryptEvent(client, event) {
console.warn(
`Error decrypting event (id=${event.getId()}): ${e}`,
);
if (!(e instanceof Crypto.DecryptionError)) {
if (e.name !== "DecryptionError") {
throw e;
}
_badEncryptedMessage(event, e.message);