mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-27 15:44:27 +02:00
🥅 Updates error catching functionality, to handle stack traces
This commit is contained in:
parent
aa770d6629
commit
f9a0005740
@ -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 */
|
/* Prints the app name and version, helpful for debugging */
|
||||||
export const welcomeMsg = () => {
|
export const welcomeMsg = () => {
|
||||||
@ -7,13 +7,16 @@ export const welcomeMsg = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Prints warning message, usually when there is a configuration error */
|
/* Prints warning message, usually when there is a configuration error */
|
||||||
export const warningMsg = (message) => {
|
export const warningMsg = (message, stack) => {
|
||||||
console.info(
|
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`,
|
`\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;",
|
"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;',
|
'font-weight: bold; font-size: 1rem;color: #ceb73f;',
|
||||||
"color: #ceb73f; font-size: 0.75rem; font-family: Tahoma, 'Trebuchet MS', Helvetica;",
|
"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 */
|
/* Prints status message */
|
||||||
|
@ -24,9 +24,7 @@ const appendToErrorLog = (msg) => {
|
|||||||
*/
|
*/
|
||||||
const ErrorHandler = function handler(msg, errorStack) {
|
const ErrorHandler = function handler(msg, errorStack) {
|
||||||
// Print to console
|
// Print to console
|
||||||
warningMsg(msg);
|
warningMsg(msg, errorStack);
|
||||||
// If stack trace included, then print that too
|
|
||||||
if (errorStack) console.warn(errorStack); // eslint-disable-line no-console
|
|
||||||
// Save to local storage
|
// Save to local storage
|
||||||
appendToErrorLog(msg);
|
appendToErrorLog(msg);
|
||||||
// Report to bug tracker (if enabled)
|
// Report to bug tracker (if enabled)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user