From 87a933f39c3a33a4e3243dab0792a52f4cc979a3 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Fri, 24 Apr 2026 22:31:58 +0200 Subject: [PATCH] fix: replace silent catch blocks with warnings --- src/App.tsx | 6 +++--- src/components/note-item/PropertyChips.tsx | 2 +- src/components/useEditorLinkActivation.ts | 2 +- src/hooks/useAutoGit.ts | 2 +- src/hooks/useAutoSync.ts | 2 +- src/hooks/useMainWindowSizeConstraints.ts | 2 +- src/hooks/useMenuEvents.ts | 2 +- src/hooks/useTelemetry.ts | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 8000bff2..7f1c36f4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -423,7 +423,7 @@ function App() { const handleFocus = () => { invoke('detect_renames', { vaultPath: resolvedPath }) .then(renames => { if (renames.length > 0) setDetectedRenames(renames) }) - .catch(() => {}) // ignore errors (e.g., no git) + .catch((err) => console.warn('[vault] Git rename detection failed:', err)) } window.addEventListener('focus', handleFocus) return () => window.removeEventListener('focus', handleFocus) @@ -556,7 +556,7 @@ function App() { if (!isTauri()) { document.title = title; return } import('@tauri-apps/api/window').then(({ getCurrentWindow }) => { getCurrentWindow().setTitle(title) - }).catch(() => {}) + }).catch((err) => console.warn('[window] Failed to update note window title:', err)) }, [noteWindowParams, notes.tabs, notes.activeTabPath]) // Keep note entry in sync with vault entries so banners (trash/archive) @@ -1034,7 +1034,7 @@ function App() { inspectorCollapsed: nextInspectorCollapsed, }) - void applyMainWindowSizeConstraints(minWidth).catch(() => {}) + void applyMainWindowSizeConstraints(minWidth).catch((err) => console.warn('[window] Size constraints failed:', err)) }, [layout.inspectorCollapsed, noteWindowParams]) const handleSetViewMode = useCallback((mode: ViewMode) => { diff --git a/src/components/note-item/PropertyChips.tsx b/src/components/note-item/PropertyChips.tsx index f588a47f..cf1add0c 100644 --- a/src/components/note-item/PropertyChips.tsx +++ b/src/components/note-item/PropertyChips.tsx @@ -87,7 +87,7 @@ async function handleChipClick( return } - await openExternalUrl(chip.action.url).catch(() => {}) + await openExternalUrl(chip.action.url).catch((err) => console.warn('[link] Failed to open URL:', err)) } export function PropertyChips({ diff --git a/src/components/useEditorLinkActivation.ts b/src/components/useEditorLinkActivation.ts index bf52d47f..f8c7e4da 100644 --- a/src/components/useEditorLinkActivation.ts +++ b/src/components/useEditorLinkActivation.ts @@ -66,7 +66,7 @@ export function useEditorLinkActivation( event.preventDefault() event.stopPropagation() - openExternalUrl(urlTarget).catch(() => {}) + openExternalUrl(urlTarget).catch((err) => console.warn('[link] Failed to open URL:', err)) } container.addEventListener('click', handleClick, true) diff --git a/src/hooks/useAutoGit.ts b/src/hooks/useAutoGit.ts index 6faeb947..a0589231 100644 --- a/src/hooks/useAutoGit.ts +++ b/src/hooks/useAutoGit.ts @@ -125,7 +125,7 @@ export function useAutoGit({ void onCheckpoint(trigger).then((didRun) => { if (didRun) markTriggerAsHandled(lastTriggeredRef.current, trigger, lastActivityAt) - }).catch(() => {}) + }).catch((err) => console.warn('[git] Auto-commit failed:', err)) }) const updateAppActivity = useEffectEvent((active: boolean) => { diff --git a/src/hooks/useAutoSync.ts b/src/hooks/useAutoSync.ts index c0d294fd..0896ef23 100644 --- a/src/hooks/useAutoSync.ts +++ b/src/hooks/useAutoSync.ts @@ -127,7 +127,7 @@ function useCommitInfoRefresher( return useCallback(() => { tauriCall('get_last_commit_info', { vaultPath }) .then(info => setLastCommitInfo(info)) - .catch(() => {}) + .catch((err) => console.warn('[sync] Failed to refresh last commit info:', err)) }, [vaultPath, setLastCommitInfo]) } diff --git a/src/hooks/useMainWindowSizeConstraints.ts b/src/hooks/useMainWindowSizeConstraints.ts index e579ac4b..480987fb 100644 --- a/src/hooks/useMainWindowSizeConstraints.ts +++ b/src/hooks/useMainWindowSizeConstraints.ts @@ -61,7 +61,7 @@ export function useMainWindowSizeConstraints({ void (async () => { if (cancelled) return await applyMainWindowSizeConstraints(minWidth) - })().catch(() => {}) + })().catch((err) => console.warn('[window] Size constraints failed:', err)) return () => { cancelled = true diff --git a/src/hooks/useMenuEvents.ts b/src/hooks/useMenuEvents.ts index f3e77880..42e33a4d 100644 --- a/src/hooks/useMenuEvents.ts +++ b/src/hooks/useMenuEvents.ts @@ -54,7 +54,7 @@ function syncNativeMenuState(state: MenuStatePayload): void { import('@tauri-apps/api/core') .then(({ invoke }) => invoke('update_menu_state', { state })) - .catch(() => {}) + .catch((err) => console.warn('[menu] Failed to sync native menu state:', err)) } function useNativeMenuEventListener(handlersRef: { current: MenuEventHandlers }) { diff --git a/src/hooks/useTelemetry.ts b/src/hooks/useTelemetry.ts index 1dcae31e..baa7e426 100644 --- a/src/hooks/useTelemetry.ts +++ b/src/hooks/useTelemetry.ts @@ -26,7 +26,7 @@ function syncCrashReporting( if (!wasEnabled) return teardownSentry() - tauriCall('reinit_telemetry').catch(() => {}) + tauriCall('reinit_telemetry').catch((err) => console.warn('[telemetry] Reinit failed:', err)) } function syncAnalytics(