summaryrefslogtreecommitdiff
path: root/ext/mixed
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-07 21:04:58 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-08 21:44:25 -0400
commit6a6e200ef947b92576351e39fc30b6653a576d70 (patch)
treeebe6bce781d597eb04dbea85395d9795409897d0 /ext/mixed
parent88de4271843197d37243a9ac360236f9dfb414e1 (diff)
Update rejections to use Error
Diffstat (limited to 'ext/mixed')
-rw-r--r--ext/mixed/js/extension.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/mixed/js/extension.js b/ext/mixed/js/extension.js
index 1a87003d..5e925124 100644
--- a/ext/mixed/js/extension.js
+++ b/ext/mixed/js/extension.js
@@ -53,6 +53,21 @@ function extensionHasBrowser() {
}
}
+function errorToJson(error) {
+ return {
+ name: error.name,
+ message: error.message,
+ stack: error.stack
+ };
+}
+
+function jsonToError(jsonError) {
+ const error = new Error(jsonError.message);
+ error.name = jsonError.name;
+ error.stack = jsonError.stack;
+ return error;
+}
+
const EXTENSION_IS_BROWSER_EDGE = (
extensionHasBrowser() &&
(!extensionHasChrome() || (typeof chrome.runtime === 'undefined' && typeof browser.runtime !== 'undefined'))