-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Labels
beginner friendlyEasy tasks, no coding experience requiredEasy tasks, no coding experience requiredenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersjavascriptJavaScript functionalityJavaScript functionality
Description
Currently, errors in localStorage operations fail silently, making debugging difficult.
Task
Add console.warn() to catch blocks for better debugging.
Location
js/theme-toggle.js - Lines 17 and 27
Current Code (Silent)
try {
localStorage.setItem("theme", theme);
} catch (e) {} // ❌ Silent - errors disappearImproved Code
try {
localStorage.setItem("theme", theme);
} catch (e) {
console.warn("Unable to save theme preference:", e);
}Files to Update
- Line 17:
localStorage.getItemcatch - Line 27:
localStorage.setItemcatch
Testing
- Test in private browsing (localStorage disabled)
- Check console for warnings
- Theme should still work (graceful degradation)
Learning Opportunity
Learn about:
- Error handling best practices
- Console logging
- Graceful degradation
Difficulty: Easy
Estimated Time: 10-15 minutes
Related: PR #26
Metadata
Metadata
Assignees
Labels
beginner friendlyEasy tasks, no coding experience requiredEasy tasks, no coding experience requiredenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersjavascriptJavaScript functionalityJavaScript functionality