summaryrefslogtreecommitdiff
path: root/ext/mixed
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed')
-rw-r--r--ext/mixed/js/core.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index 54e8a9d2..7fc01c94 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -56,7 +56,8 @@ function errorToJson(error) {
return {
name: error.name,
message: error.message,
- stack: error.stack
+ stack: error.stack,
+ data: error.data
};
}
@@ -64,6 +65,7 @@ function jsonToError(jsonError) {
const error = new Error(jsonError.message);
error.name = jsonError.name;
error.stack = jsonError.stack;
+ error.data = jsonError.data;
return error;
}
@@ -74,7 +76,11 @@ function logError(error, alert) {
const errorString = `${error.toString ? error.toString() : error}`;
const stack = `${error.stack}`.trimRight();
- errorMessage += (!stack.startsWith(errorString) ? `${errorString}\n${stack}` : `${stack}`);
+ if (!stack.startsWith(errorString)) { errorMessage += `${errorString}\n`; }
+ errorMessage += stack;
+
+ const data = error.data;
+ if (typeof data !== 'undefined') { errorMessage += `\nData: ${JSON.stringify(data, null, 4)}`; }
errorMessage += '\n\nIssues can be reported at https://github.com/FooSoft/yomichan/issues';