Adds second param to ErrorHandler for printing stack trace

This commit is contained in:
Alicia Sykes 2021-12-11 18:44:59 +00:00
parent 9915100c13
commit e8fa255e2e
1 changed files with 9 additions and 4 deletions

View File

@ -22,10 +22,15 @@ const appendToErrorLog = (msg) => {
* If error reporting is enabled, will also log the message to Sentry * If error reporting is enabled, will also log the message to Sentry
* If you wish to use your own error logging service, put code for it here * If you wish to use your own error logging service, put code for it here
*/ */
const ErrorHandler = function handler(msg) { const ErrorHandler = function handler(msg, errorStack) {
warningMsg(msg); // Print to console // Print to console
appendToErrorLog(msg); // Save to local storage warningMsg(msg);
Sentry.captureMessage(`[USER-WARN] ${msg}`); // Report to bug tracker (if enabled) // If stack trace included, then print that too
if (errorStack) console.warn(errorStack); // eslint-disable-line no-console
// Save to local storage
appendToErrorLog(msg);
// Report to bug tracker (if enabled)
Sentry.captureMessage(`[USER-WARN] ${msg}`);
}; };
/* Similar to error handler, but for recording general info */ /* Similar to error handler, but for recording general info */