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:
@@ -1,5 +1,6 @@
|
||||
// App Selector System
|
||||
(function () {
|
||||
const errorHandler = new ErrorHandler();
|
||||
injectModal('app-selector-modal', `<div id="app-selector-modal" class="weather-modal">
|
||||
<div class="app-selector-content">
|
||||
<h2 style="margin: 0 0 24px; color: var(--fg); text-align: center;">Choose an App</h2>
|
||||
@@ -230,7 +231,7 @@
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to fetch app templates:', e);
|
||||
errorHandler.logError('[AppSelector] Fetch Templates', e, { function: 'fetchApiTemplates' });
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -242,7 +243,7 @@
|
||||
const data = await response.json();
|
||||
return data;
|
||||
} catch (e) {
|
||||
console.error('Failed to check port:', e);
|
||||
errorHandler.logError('[AppSelector] Check Port', e, { function: 'checkPortAvailability' });
|
||||
return { available: true }; // Assume available on error
|
||||
}
|
||||
}
|
||||
@@ -256,7 +257,7 @@
|
||||
return data.suggestedPort;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to get suggested port:', e);
|
||||
errorHandler.logError('[AppSelector] Get Suggested Port', e, { function: 'getSuggestedPort' });
|
||||
}
|
||||
return basePort;
|
||||
}
|
||||
@@ -842,7 +843,7 @@
|
||||
throw new Error(result.error || 'Deployment failed');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Deployment error:', error);
|
||||
errorHandler.logError('[AppSelector] Deployment', error, { function: 'deploy' });
|
||||
showNotification(
|
||||
`Failed to deploy ${appTemplate.name}: ${error.message}`,
|
||||
'error',
|
||||
|
||||
Reference in New Issue
Block a user