diff --git a/src/utils/CoolConsole.js b/src/utils/CoolConsole.js index 2871d0a5..eaeefdcf 100644 --- a/src/utils/CoolConsole.js +++ b/src/utils/CoolConsole.js @@ -1,4 +1,4 @@ -/* eslint no-console: ["error", { allow: ["log", "info"] }] */ +/* eslint no-console: ["error", { allow: ["log", "info", "warn"] }] */ /* Prints the app name and version, helpful for debugging */ export const welcomeMsg = () => { @@ -7,13 +7,16 @@ export const welcomeMsg = () => { }; /* Prints warning message, usually when there is a configuration error */ -export const warningMsg = (message) => { +export const warningMsg = (message, stack) => { console.info( `\n%c⚠️ Warning ⚠️%c \n${message} \n\n%cThis is likely not an issue with Dashy, but rather your configuration. If you think it is a bug, please open a ticket on GitHub: https://git.io/JukXk`, "color:#ceb73f; background: #ceb73f33; font-size:1.5rem; padding:0.15rem; margin: 1rem auto; font-family: Rockwell, Tahoma, 'Trebuchet MS', Helvetica; border: 2px solid #ceb73f; border-radius: 4px; font-weight: bold; text-shadow: 1px 1px 1px #000000bf;", 'font-weight: bold; font-size: 1rem;color: #ceb73f;', "color: #ceb73f; font-size: 0.75rem; font-family: Tahoma, 'Trebuchet MS', Helvetica;", ); + if (stack) { + console.warn(`%cStack Trace%c\n${stack}`, 'font-weight: bold;', ''); + } }; /* Prints status message */ diff --git a/src/utils/ErrorHandler.js b/src/utils/ErrorHandler.js index 4c56e900..c62dc725 100644 --- a/src/utils/ErrorHandler.js +++ b/src/utils/ErrorHandler.js @@ -24,9 +24,7 @@ const appendToErrorLog = (msg) => { */ 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 + warningMsg(msg, errorStack); // Save to local storage appendToErrorLog(msg); // Report to bug tracker (if enabled)