Skip to content

Commit 214b6c8

Browse files
🌱 Upgrade swallowed console.warn to console.error for cache failures (#15941)
Fixes #15929 - Upgraded console.warn β†’ console.error in main.tsx cache migration handler - Upgraded console.warn β†’ console.error in useNightlyE2EData.ts cache read - Updated test spy to match new console.error usage Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4d7bf68 commit 214b6c8

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

β€Žweb/src/hooks/__tests__/useNightlyE2EData-funcs.test.tsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ describe('loadCachedData', () => {
7777

7878
it('returns empty guides when localStorage has invalid JSON', () => {
7979
localStorage.setItem(LS_CACHE_KEY, '{not valid json')
80-
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
80+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
8181
try {
8282
const result = loadCachedData()
8383
expect(result).toEqual({ guides: [], isDemo: false })
84-
expect(warnSpy).toHaveBeenCalledOnce()
84+
expect(errorSpy).toHaveBeenCalledOnce()
8585
} finally {
86-
warnSpy.mockRestore()
86+
errorSpy.mockRestore()
8787
}
8888
})
8989

β€Žweb/src/hooks/useNightlyE2EData.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function loadCachedData(): NightlyE2EData {
4141
const parsed = JSON.parse(raw) as NightlyE2EData
4242
if (parsed.guides?.length > 0 && !parsed.isDemo) return parsed
4343
}
44-
} catch (e: unknown) { console.warn('[useNightlyE2EData] failed to read cached nightly data:', e) }
44+
} catch (e: unknown) { console.error('[useNightlyE2EData] failed to read cached nightly data:', e) }
4545
return { guides: [], isDemo: false }
4646
}
4747

β€Žweb/src/main.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ enableMocking()
166166
initPreloadedMeta(meta)
167167
} catch (e: unknown) {
168168
logOpfsFallback('[Cache] SQLite worker init: using IndexedDB fallback:', e)
169-
try { await migrateFromLocalStorage() } catch (migrateErr: unknown) { console.warn('[Cache] failed to migrate from localStorage:', migrateErr) }
169+
try { await migrateFromLocalStorage() } catch (migrateErr: unknown) { console.error('[Cache] failed to migrate from localStorage:', migrateErr) }
170170
}
171171
})()
172172

0 commit comments

Comments
Β (0)