From e8fa255e2ecc110f903c6b97fa9713871af2069f Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 11 Dec 2021 18:44:59 +0000 Subject: [PATCH] :zap: Adds second param to ErrorHandler for printing stack trace --- src/utils/ErrorHandler.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/utils/ErrorHandler.js b/src/utils/ErrorHandler.js index 280c4a0a..4c56e900 100644 --- a/src/utils/ErrorHandler.js +++ b/src/utils/ErrorHandler.js @@ -22,10 +22,15 @@ const appendToErrorLog = (msg) => { * 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 */ -const ErrorHandler = function handler(msg) { - warningMsg(msg); // Print to console - appendToErrorLog(msg); // Save to local storage - Sentry.captureMessage(`[USER-WARN] ${msg}`); // Report to bug tracker (if enabled) +const ErrorHandler = function handler(msg, errorStack) { + // Print to console + warningMsg(msg); + // 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 */