aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/extension.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/extension.js')
-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'))