🔊 Improve JS error reporting in Firefox

It turns out the issues we had with the less helpful
JS error output under Firefox was simply due to
the error message not being included in the
stack trace, vs Chrome where it is.

Solved this by always including the message.
This commit is contained in:
Gina Häußge committed 2023-02-27 12:06:29 +01:00
1 parent 628df9e8cd
commit 5118088ad6
4 files changed
+15 -10

No files matched your search

+1 -1
View File
@@ -172,7 +172,7 @@ _PLUGIN_BUNDLE_WRAPPER_PREFIX = """// JS assets for plugin {plugin}
"""
_PLUGIN_BUNDLE_WRAPPER_SUFFIX = """
}} catch (error) {{
log.error("Error in JS assets for plugin {plugin}:", (error.stack || error));
log.error("Error in JS assets for plugin {plugin}:", `${{exc.message}}\n${{exc.stack || exc}}`);
}}
}})();
"""
+3 -3
View File
@@ -1367,7 +1367,7 @@ function setOnViewModelIf(viewModel, key, value, condition) {
"on view model",
viewModel.constructor.name,
":",
exc.stack || exc
`${exc.message}\n${exc.stack || exc}`
);
}
}
@@ -1392,7 +1392,7 @@ function callViewModelsIf(allViewModels, method, condition, callback) {
"on view model",
viewModel.constructor.name,
":",
exc.stack || exc
`${exc.message}\n${exc.stack || exc}`
);
}
});
@@ -1476,7 +1476,7 @@ function callViewModelIf(viewModel, method, condition, callback, raiseErrors) {
"on view model",
viewModel.constructor.name,
":",
exc.stack || exc
`${exc.message}\n${exc.stack || exc}`
);
}
}
+10 -5
View File
@@ -506,7 +506,12 @@ $(function () {
if (typeof Sentry !== "undefined") {
Sentry.captureException(exc);
}
log.error("Error instantiating", viewModel.name, ":", exc.stack || exc);
log.error(
"Error instantiating",
viewModel.name,
":",
`${exc.message}\n${exc.stack || exc}`
);
continue;
}
@@ -794,7 +799,7 @@ $(function () {
"Error calling onBeforeBinding on view model",
viewModel.constructor.name,
":",
exc.stack || exc
`${exc.message}\n${exc.stack || exc}`
);
return;
}
@@ -829,7 +834,7 @@ $(function () {
"of view model",
viewModel.constructor.name,
":",
exc.stack || exc
`${exc.message}\n${exc.stack || exc}`
);
return;
}
@@ -887,7 +892,7 @@ $(function () {
"to target",
target,
":",
exc.stack || exc
`${exc.message}\n${exc.stack || exc}`
);
}
});
@@ -911,7 +916,7 @@ $(function () {
"Error while processing view model",
name,
"for binding:",
exc.stack || exc
`${exc.message}\n${exc.stack || exc}`
);
}
});
@@ -719,7 +719,7 @@ $(function () {
"Error calling settings callback",
callback,
":",
exc.stack || exc.stacktrace || exc
`${exc.message}\n${exc.stack || exc}`
);
}
};