fix: replace silent catch blocks with warnings

This commit is contained in:
lucaronin
2026-04-24 22:31:58 +02:00
parent 54c0efa3e4
commit 87a933f39c
8 changed files with 10 additions and 10 deletions

View File

@@ -423,7 +423,7 @@ function App() {
const handleFocus = () => {
invoke<DetectedRename[]>('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) => {

View File

@@ -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({

View File

@@ -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)

View File

@@ -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) => {

View File

@@ -127,7 +127,7 @@ function useCommitInfoRefresher(
return useCallback(() => {
tauriCall<LastCommitInfo | null>('get_last_commit_info', { vaultPath })
.then(info => setLastCommitInfo(info))
.catch(() => {})
.catch((err) => console.warn('[sync] Failed to refresh last commit info:', err))
}, [vaultPath, setLastCommitInfo])
}

View File

@@ -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

View File

@@ -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 }) {

View File

@@ -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(