fix: route all console.error through ErrorHandler for consistent tracking
Converted 35+ raw console.error calls to use ErrorHandler.logError() across 12 files. ErrorHandler provides structured logging, local error storage, and error tracking integration. Files: - app-selector.js: 4 errors (fetch templates, port check, suggested port, deploy) - globals.js: 2 errors (CSRF token get/add) - service-credentials.js: 2 errors (save/clear credentials) - totp-settings.js: 4 errors (TOTP setup, session duration, disable, AuthCard) - notification-settings.js: 2 errors (load config, load history) - setup-wizard.js: 2 errors (save config to server) - progress-tracker.js: 4 errors (storage read/write/session/fallback) - tooltip-definitions.js: 2 errors (validation, condition eval) - tour-manager.js: 2 errors (Driver.js not loaded, tooltip not found) - theme-adapter.js: 1 error (theme change callback) - weather.js: 1 error (weather update) - onboarding.js: removed duplicate console.error, fixed 2 remaining calls All console.error calls in the DashCaddy frontend now go through ErrorHandler.
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
(function(window) {
|
||||
'use strict';
|
||||
|
||||
const errorHandler = new ErrorHandler();
|
||||
|
||||
const debug = (...args) => {
|
||||
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||
};
|
||||
@@ -72,7 +74,7 @@
|
||||
const data = localStorage.getItem(this.storageKey);
|
||||
return data ? JSON.parse(data) : null;
|
||||
} catch (error) {
|
||||
console.error('[ProgressTracker] Error reading from storage:', error);
|
||||
errorHandler.logError('[ProgressTracker] Read Storage', error, { function: '_getStorage' });
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +88,7 @@
|
||||
try {
|
||||
localStorage.setItem(this.storageKey, JSON.stringify(state));
|
||||
} catch (error) {
|
||||
console.error('[ProgressTracker] Error writing to storage:', error);
|
||||
errorHandler.logError('[ProgressTracker] Write Storage', error, { function: '_setStorage' });
|
||||
// Handle quota exceeded or storage unavailable
|
||||
// Fall back to session storage or in-memory storage
|
||||
this._handleStorageError(error);
|
||||
@@ -104,7 +106,7 @@
|
||||
sessionStorage.setItem(this.storageKey, JSON.stringify(this._getStorage()));
|
||||
console.warn('[ProgressTracker] Falling back to session storage');
|
||||
} catch (sessionError) {
|
||||
console.error('[ProgressTracker] Session storage also unavailable:', sessionError);
|
||||
errorHandler.logError('[ProgressTracker] Session Storage Unavailable', sessionError, { function: '_handleStorageError' });
|
||||
// Could implement in-memory fallback here if needed
|
||||
}
|
||||
}
|
||||
@@ -190,7 +192,7 @@
|
||||
body: JSON.stringify({ onboardingCompleted: true })
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('[ProgressTracker] Failed to persist install onboarding state:', error);
|
||||
errorHandler.logError('[ProgressTracker] Persist Install Onboarding', error, { function: 'markInstallOnboardingCompleted' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user