Skip to content

Commit

Permalink
Merge pull request matrix-org#758 from matrix-org/bwindels/betteridbe…
Browse files Browse the repository at this point in the history
…rrors

throw error with same name and message over idb worker boundary
  • Loading branch information
dbkr committed Oct 9, 2018
2 parents a4b2cc8 + caba350 commit 92fbf58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/store/indexeddb-remote-backend.js
Expand Up @@ -184,7 +184,9 @@ RemoteIndexedDBStoreBackend.prototype = {
if (msg.command == 'cmd_success') {
def.resolve(msg.result);
} else {
def.reject(msg.error);
const error = new Error(msg.error.message);
error.name = msg.error.name;
def.reject(error);
}
} else {
console.warn("Unrecognised message from worker: " + msg);
Expand Down
5 changes: 4 additions & 1 deletion src/store/indexeddb-store-worker.js
Expand Up @@ -135,7 +135,10 @@ class IndexedDBStoreWorker {
command: 'cmd_fail',
seq: msg.seq,
// Just send a string because Error objects aren't cloneable
error: "Error running command",
error: {
message: err.message,
name: err.name,
},
});
});
}
Expand Down

0 comments on commit 92fbf58

Please sign in to comment.