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:
parent
4c256202f7
commit
5b6e7aae6b
11 changed files with 133 additions and 93 deletions
|
|
@ -17,8 +17,9 @@ export function registerMemoHandlers(): void {
|
|||
ipcMain.handle(IPC_CHANNELS.MEMO.GET_TAGS, async (_event, params: GetTagsParams) => {
|
||||
try {
|
||||
return ipcSuccess(getMemoService().getTagsForEntry(params.historyId))
|
||||
} catch {
|
||||
return ipcError(ErrorCode.DBQueryFailed, 'Failed to get tags for history entry')
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
return ipcError(ErrorCode.DBQueryFailed, `Failed to get tags for history entry: ${message}`)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -48,16 +49,18 @@ export function registerMemoHandlers(): void {
|
|||
ipcMain.handle(IPC_CHANNELS.MEMO.GET_ALL_TAGS, async () => {
|
||||
try {
|
||||
return ipcSuccess(getMemoService().getAllTags())
|
||||
} catch {
|
||||
return ipcError(ErrorCode.DBQueryFailed, 'Failed to get all tags')
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
return ipcError(ErrorCode.DBQueryFailed, `Failed to get all tags: ${message}`)
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.MEMO.SEARCH_BY_TAG, async (_event, params: SearchByTagParams) => {
|
||||
try {
|
||||
return ipcSuccess(getMemoService().searchByTag(params))
|
||||
} catch {
|
||||
return ipcError(ErrorCode.DBQueryFailed, 'Failed to search by tag')
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
return ipcError(ErrorCode.DBQueryFailed, `Failed to search by tag: ${message}`)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue