fix: add dev-mode warnings to all 24 silent catch blocks

Every empty/comment-only catch block now logs a descriptive warning
in dev mode via `if (import.meta.env.DEV) console.warn(...)`. Covers
15 files across views, stores, components, and utils. Zero silent
catches remaining.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-11 00:58:55 +00:00
parent 7a7cbf1da3
commit bc879b3581
16 changed files with 45 additions and 43 deletions

View File

@@ -66,7 +66,7 @@
- [x] **QUAL-01** — Run full sweep and record baseline. Execute `/sweep` skill. Record the initial violation counts in `docs/quality-baseline.md`. This becomes the regression target -- violation counts must only go down, never up. **Acceptance**: Baseline document exists with all metrics. - [x] **QUAL-01** — Run full sweep and record baseline. Execute `/sweep` skill. Record the initial violation counts in `docs/quality-baseline.md`. This becomes the regression target -- violation counts must only go down, never up. **Acceptance**: Baseline document exists with all metrics.
- [ ] **QUAL-02** — Fix all silent catch blocks. Grep for empty catch blocks across `neode-ui/src/`. Each silent catch should either: log in dev mode (`if (import.meta.env.DEV) console.warn(...)`), re-throw, or handle the error in the UI. Target: zero silent catches. **Acceptance**: `/sweep` "Silent catches" = PASS. - [x] **QUAL-02** — Fix all silent catch blocks. Grep for empty catch blocks across `neode-ui/src/`. Each silent catch should either: log in dev mode (`if (import.meta.env.DEV) console.warn(...)`), re-throw, or handle the error in the UI. Target: zero silent catches. **Acceptance**: `/sweep` "Silent catches" = PASS.
- [ ] **QUAL-03** — Remove all console.log in production paths. Grep for `console.log` in `neode-ui/src/**/*.{ts,vue}` excluding dev-gated lines. Wrap each in `if (import.meta.env.DEV)` or replace with proper error handling. **Acceptance**: `/sweep` "Console.log" = PASS. - [ ] **QUAL-03** — Remove all console.log in production paths. Grep for `console.log` in `neode-ui/src/**/*.{ts,vue}` excluding dev-gated lines. Wrap each in `if (import.meta.env.DEV)` or replace with proper error handling. **Acceptance**: `/sweep` "Console.log" = PASS.

View File

@@ -302,7 +302,7 @@ export class WebSocketClient {
try { try {
this.ws.close() this.ws.close()
} catch (e) { } catch (e) {
// Ignore errors if (import.meta.env.DEV) console.warn('WebSocket close error', e)
} }
this.ws = null this.ws = null
} }

View File

@@ -255,8 +255,8 @@ function checkIframeContent() {
if (!body || (body.children.length === 0 && body.innerText.trim() === '')) { if (!body || (body.children.length === 0 && body.innerText.trim() === '')) {
iframeBlocked.value = true iframeBlocked.value = true
} }
} catch { } catch (e) {
// Cross-origin: can't access, assume working if (import.meta.env.DEV) console.warn('Cross-origin: can\'t access iframe, assume working', e)
} }
} }
@@ -289,8 +289,8 @@ async function sendIdentityIfSupported() {
challenge, challenge,
signature: sigRes.signature signature: sigRes.signature
}, '*') }, '*')
} catch { } catch (e) {
// Identity not available — continue without it if (import.meta.env.DEV) console.warn('Identity not available — continuing without it', e)
} }
} }

View File

@@ -178,7 +178,8 @@ function loadSavedPosition() {
} else { } else {
savedPosition.value = null savedPosition.value = null
} }
} catch { } catch (e) {
if (import.meta.env.DEV) console.warn('Failed to load saved CLI position', e)
savedPosition.value = null savedPosition.value = null
} }
} }
@@ -187,8 +188,8 @@ function savePosition(x: number, y: number) {
savedPosition.value = { x, y } savedPosition.value = { x, y }
try { try {
localStorage.setItem(SAVED_POSITION_KEY, JSON.stringify({ x, y })) localStorage.setItem(SAVED_POSITION_KEY, JSON.stringify({ x, y }))
} catch { } catch (e) {
// ignore if (import.meta.env.DEV) console.warn('Failed to save CLI position', e)
} }
} }

View File

@@ -191,7 +191,8 @@ function loadSavedPosition() {
} else { } else {
savedPosition.value = null savedPosition.value = null
} }
} catch { } catch (e) {
if (import.meta.env.DEV) console.warn('Failed to load saved spotlight position', e)
savedPosition.value = null savedPosition.value = null
} }
} }
@@ -200,8 +201,8 @@ function savePosition(x: number, y: number) {
savedPosition.value = { x, y } savedPosition.value = { x, y }
try { try {
localStorage.setItem(SAVED_POSITION_KEY, JSON.stringify({ x, y })) localStorage.setItem(SAVED_POSITION_KEY, JSON.stringify({ x, y }))
} catch { } catch (e) {
// ignore if (import.meta.env.DEV) console.warn('Failed to save spotlight position', e)
} }
} }

View File

@@ -173,8 +173,8 @@ onMounted(async () => {
} }
} }
} }
} catch { } catch (e) {
// Not shared yet, defaults are fine if (import.meta.env.DEV) console.warn('Not shared yet, defaults are fine', e)
} }
}) })

View File

@@ -95,8 +95,8 @@ export const useAIPermissionsStore = defineStore('aiPermissions', () => {
const parsed = JSON.parse(stored) as AIContextCategory[] const parsed = JSON.parse(stored) as AIContextCategory[]
return new Set(parsed.filter(c => AI_PERMISSION_CATEGORIES.some(cat => cat.id === c))) return new Set(parsed.filter(c => AI_PERMISSION_CATEGORIES.some(cat => cat.id === c)))
} }
} catch { } catch (e) {
// ignore if (import.meta.env.DEV) console.warn('Failed to load AI permissions from storage', e)
} }
return new Set() return new Set()
} }

View File

@@ -41,8 +41,8 @@ export const useSpotlightStore = defineStore('spotlight', () => {
recentItems.value = [withTimestamp, ...filtered].slice(0, MAX_RECENT_ITEMS) recentItems.value = [withTimestamp, ...filtered].slice(0, MAX_RECENT_ITEMS)
try { try {
localStorage.setItem(RECENT_ITEMS_KEY, JSON.stringify(recentItems.value)) localStorage.setItem(RECENT_ITEMS_KEY, JSON.stringify(recentItems.value))
} catch { } catch (e) {
// Ignore storage errors if (import.meta.env.DEV) console.warn('Failed to save recent items to storage', e)
} }
} }

View File

@@ -9,8 +9,8 @@ export const useWeb5BadgeStore = defineStore('web5Badge', () => {
try { try {
const res = await rpcClient.call<{ requests: Array<{ id: string }> }>({ method: 'network.list-requests' }) const res = await rpcClient.call<{ requests: Array<{ id: string }> }>({ method: 'network.list-requests' })
pendingRequestCount.value = res.requests?.length ?? 0 pendingRequestCount.value = res.requests?.length ?? 0
} catch { } catch (e) {
// ignore — badge is best-effort if (import.meta.env.DEV) console.warn('Badge refresh failed — best-effort', e)
} }
} }

View File

@@ -40,7 +40,7 @@ export async function fetchGitHubAppInfo(repoUrl: string, appId: string): Promis
targetRepo = start9RepoName targetRepo = start9RepoName
} }
} catch (e) { } catch (e) {
// Fall back to original repo if (import.meta.env.DEV) console.warn('Start9 repo lookup failed, falling back to original repo', e)
} }
} }
@@ -90,7 +90,7 @@ export async function fetchGitHubAppInfo(repoUrl: string, appId: string): Promis
} }
} }
} catch (e) { } catch (e) {
// Try next path if (import.meta.env.DEV) console.warn('Icon path lookup failed, trying next path', e)
} }
} }
@@ -108,7 +108,7 @@ export async function fetchGitHubAppInfo(repoUrl: string, appId: string): Promis
} }
} }
} catch (e) { } catch (e) {
// No icon from releases if (import.meta.env.DEV) console.warn('No icon from releases', e)
} }
} }
@@ -132,7 +132,7 @@ export async function fetchGitHubAppInfo(repoUrl: string, appId: string): Promis
break break
} }
} catch (e) { } catch (e) {
// Try next URL if (import.meta.env.DEV) console.warn('Raw icon URL failed, trying next URL', e)
} }
} }
} }

View File

@@ -172,8 +172,8 @@ async function loadCounts() {
sectionCounts.value[section.id] = 0 sectionCounts.value[section.id] = 0
} }
} }
} catch { } catch (e) {
// Silently fail if (import.meta.env.DEV) console.warn('FileBrowser count loading failed silently', e)
} }
} }

View File

@@ -523,8 +523,8 @@ onMounted(async () => {
const usage = await fileBrowserClient.getUsage() const usage = await fileBrowserClient.getUsage()
cloudStorageUsed.value = usage.totalSize cloudStorageUsed.value = usage.totalSize
cloudFolderCount.value = usage.folderCount cloudFolderCount.value = usage.folderCount
} catch { } catch (e) {
// FileBrowser may not be running — leave as loading if (import.meta.env.DEV) console.warn('FileBrowser may not be running', e)
} }
loadSystemStats() loadSystemStats()
systemStatsInterval = setInterval(loadSystemStats, 30000) systemStatsInterval = setInterval(loadSystemStats, 30000)
@@ -583,8 +583,8 @@ async function loadSystemStats() {
systemStats.diskTotal = res.disk_total_bytes systemStats.diskTotal = res.disk_total_bytes
systemStats.diskPercent = res.disk_total_bytes > 0 ? (res.disk_used_bytes / res.disk_total_bytes) * 100 : 0 systemStats.diskPercent = res.disk_total_bytes > 0 ? (res.disk_used_bytes / res.disk_total_bytes) * 100 : 0
systemStats.uptimeSecs = res.uptime_secs systemStats.uptimeSecs = res.uptime_secs
} catch { } catch (e) {
// RPC unavailable — keep defaults if (import.meta.env.DEV) console.warn('RPC unavailable — keeping defaults', e)
} }
} }

View File

@@ -97,8 +97,8 @@ function selectOption(option: string) {
async function proceed() { async function proceed() {
try { try {
await completeOnboarding() await completeOnboarding()
} catch { } catch (e) {
// localStorage fallback in completeOnboarding ensures onboarding is marked complete if (import.meta.env.DEV) console.warn('completeOnboarding failed, localStorage fallback ensures onboarding is marked complete', e)
} }
router.push('/login').catch(() => {}) router.push('/login').catch(() => {})
} }

View File

@@ -387,8 +387,8 @@ async function loadNetworkData() {
const count = fwdRes.value.forwards?.length ?? 0 const count = fwdRes.value.forwards?.length ?? 0
networkData.value.forwardCount = `${count} rule${count !== 1 ? 's' : ''}` networkData.value.forwardCount = `${count} rule${count !== 1 ? 's' : ''}`
} }
} catch { } catch (e) {
// Keep N/A defaults on failure if (import.meta.env.DEV) console.warn('Keep N/A defaults on failure', e)
} finally { } finally {
networkLoading.value = false networkLoading.value = false
} }

View File

@@ -684,8 +684,8 @@ async function loadTotpStatus() {
try { try {
const res = await rpcClient.totpStatus() const res = await rpcClient.totpStatus()
totpEnabled.value = res.enabled totpEnabled.value = res.enabled
} catch { } catch (e) {
// Ignore - may not be available if (import.meta.env.DEV) console.warn('TOTP status may not be available', e)
} }
} }
@@ -873,14 +873,14 @@ onMounted(async () => {
try { try {
const res = await rpcClient.getTorAddress() const res = await rpcClient.getTorAddress()
torAddressFromRpc.value = res.tor_address ?? null torAddressFromRpc.value = res.tor_address ?? null
} catch { } catch (e) {
// Ignore - tor address may not be available yet if (import.meta.env.DEV) console.warn('Tor address may not be available yet', e)
} }
} }
}) })
async function handleLogout() { async function handleLogout() {
try { await store.logout() } catch { /* proceed */ } try { await store.logout() } catch (e) { if (import.meta.env.DEV) console.warn('Logout failed, proceeding anyway', e) }
router.push('/login').catch(() => { window.location.href = '/login' }) router.push('/login').catch(() => { window.location.href = '/login' })
} }
</script> </script>

View File

@@ -1764,8 +1764,8 @@ async function revokeCredential(id: string) {
try { try {
await rpcClient.call({ method: 'identity.revoke-credential', params: { id } }) await rpcClient.call({ method: 'identity.revoke-credential', params: { id } })
await loadCredentials() await loadCredentials()
} catch { } catch (e) {
// Silent fail for revocation if (import.meta.env.DEV) console.warn('Silent fail for revocation', e)
} }
} }
@@ -2016,8 +2016,8 @@ async function discoverAndAddPeers() {
if (n.onion && n.pubkey) { if (n.onion && n.pubkey) {
try { try {
await rpcClient.addPeer({ onion: n.onion, pubkey: n.pubkey }) await rpcClient.addPeer({ onion: n.onion, pubkey: n.pubkey })
} catch { } catch (e) {
// may already exist if (import.meta.env.DEV) console.warn('Peer may already exist', e)
} }
} }
} }