refactor(main): ipcSuccess/ipcError 헬퍼 통일 + catch(error) 패턴 (WS-PATTERN)

- cloud-sync-handlers 수동 ok/fail -> ipcSuccess/ipcError 헬퍼 (6 핸들러)
- catch {} -> catch(error) 에러 메시지 보강 32건 (11 ipc handler 파일)
KEEP: template-handlers(주석 명시 에러 무시), license-handlers(이미 헬퍼 사용),
       audio-handlers stop().catch(() => {})(의도적 무시)
정책: docs/REFACTOR_POLICY.md DP2
This commit is contained in:
Yun Chan 2026-07-22 02:38:23 +09:00
parent 4c256202f7
commit 5b6e7aae6b
11 changed files with 133 additions and 93 deletions

View file

@ -17,8 +17,9 @@ export function registerHotkeyHandlers(): void {
configSet('dictationShortcut', params.binding)
getHotkeyService().loadFromConfig()
return ipcSuccess(undefined)
} catch {
return ipcError(ErrorCode.HotkeyRegistrationFailed, 'Failed to set dictation shortcut')
} catch (error) {
const message = error instanceof Error ? error.message : String(error)
return ipcError(ErrorCode.HotkeyRegistrationFailed, `Failed to set dictation shortcut: ${message}`)
}
})
@ -31,8 +32,9 @@ export function registerHotkeyHandlers(): void {
configSet('handsFreeShortcut', params.binding)
getHotkeyService().loadFromConfig()
return ipcSuccess(undefined)
} catch {
return ipcError(ErrorCode.HotkeyRegistrationFailed, 'Failed to set hands-free shortcut')
} catch (error) {
const message = error instanceof Error ? error.message : String(error)
return ipcError(ErrorCode.HotkeyRegistrationFailed, `Failed to set hands-free shortcut: ${message}`)
}
})
@ -45,8 +47,9 @@ export function registerHotkeyHandlers(): void {
configSet('commandShortcut', params.binding)
getHotkeyService().loadFromConfig()
return ipcSuccess(undefined)
} catch {
return ipcError(ErrorCode.HotkeyRegistrationFailed, 'Failed to set command shortcut')
} catch (error) {
const message = error instanceof Error ? error.message : String(error)
return ipcError(ErrorCode.HotkeyRegistrationFailed, `Failed to set command shortcut: ${message}`)
}
})
@ -59,8 +62,9 @@ export function registerHotkeyHandlers(): void {
configSet('captionShortcut', params.binding)
getHotkeyService().loadFromConfig()
return ipcSuccess(undefined)
} catch {
return ipcError(ErrorCode.HotkeyRegistrationFailed, 'Failed to set caption shortcut')
} catch (error) {
const message = error instanceof Error ? error.message : String(error)
return ipcError(ErrorCode.HotkeyRegistrationFailed, `Failed to set caption shortcut: ${message}`)
}
})