π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
:zap: Keep recent warnings in session storage
Alicia Sykes9ee4878feec1
diff --git a/src/utils/ErrorHandler.js b/src/utils/ErrorHandler.jsindex f2a6a2e2..f430fa74 100644--- a/src/utils/ErrorHandler.js+++ b/src/utils/ErrorHandler.js@@ -1,6 +1,20 @@-/* eslint no-console: ["error", { allow: ["warn", "error"] }] */import * as Sentry from '@sentry/vue';import { warningMsg } from '@/utils/CoolConsole';+import { sessionStorageKeys } from '@/utils/defaults';++/* Makes the current time, like hh:mm:ss */+const makeTime = () => {+ const now = new Date();+ const pad = (digit) => String(digit).padStart(2, '0');+ return `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;+};++/* Appends recent errors to local storage, for viewing in the UI */+const appendToErrorLog = (msg) => {+ let errorLog = sessionStorage.getItem(sessionStorageKeys.ERROR_LOG) || '';+ errorLog += `[${makeTime()}] ${msg}\n`;+ sessionStorage.setItem(sessionStorageKeys.ERROR_LOG, errorLog);+};/*** Function called when an error happens@@ -9,8 +23,9 @@ import { warningMsg } from '@/utils/CoolConsole';* If you wish to use your own error logging service, put code for it here*/const ErrorHandler = function handler(msg) {- warningMsg(msg);- Sentry.captureMessage(`[USER-WARN] ${msg || 'Uncaptured Message'}`);+ warningMsg(msg); // Print to console+ appendToErrorLog(msg); // Save to local storage+ Sentry.captureMessage(`[USER-WARN] ${msg}`); // Report to bug tracker (if enabled)};export default ErrorHandler;