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:
Krystie
2026-05-14 01:31:55 -07:00
parent 5d404f5733
commit f60a3370db
12 changed files with 48 additions and 32 deletions
+5 -4
View File
@@ -1,5 +1,6 @@
// ===== TOTP SETTINGS =====
(function() {
const errorHandler = new ErrorHandler();
injectModal('totp-settings-modal', `<div id="totp-settings-modal" class="weather-modal">
<div class="weather-modal-content" style="min-width: 420px; max-width: 520px;">
<h3 style="margin: 0 0 16px; font-size: 1.1rem;">Authentication Settings</h3>
@@ -185,7 +186,7 @@
document.getElementById('totp-setup-code').focus();
}
} catch (e) {
console.error('TOTP setup failed:', e);
errorHandler.logError('[TOTP] Setup Failed', e, { function: 'setupTOTP' });
}
});
@@ -274,7 +275,7 @@
});
loadTotpSettings(); // Refresh modal + card (handles "never" disabling TOTP)
} catch (err) {
console.error('Failed to update session duration:', err);
errorHandler.logError('[TOTP] Update Session Duration', err, { function: 'updateSessionDuration' });
}
});
@@ -290,7 +291,7 @@
const data = await res.json();
if (data.success) loadTotpSettings();
} catch (e) {
console.error('Failed to disable TOTP:', e);
errorHandler.logError('[TOTP] Disable Failed', e, { function: 'disableTOTP' });
}
});
@@ -322,7 +323,7 @@
const active = data.config.enabled && data.config.isSetUp;
updateAuthCard(active, data.config.sessionDuration);
}
} catch (e) { console.error('[AuthCard] Failed to update:', e); }
} catch (e) { errorHandler.logError('[TOTP] AuthCard Update', e, { function: 'authCardUpdate' }); }
})();
})();