fix: resolve lint and typecheck issues

This commit is contained in:
Misaka
2026-03-21 09:33:07 +08:00
parent 2fba07fd8f
commit 2b4a09dabe
26 changed files with 356 additions and 336 deletions

View File

@@ -25,6 +25,11 @@ export type { IpcResult } from '../types/ipc.types'
const log = createLogger('IPC')
function getErrorCauseMessage(error: { cause?: unknown }): string | undefined {
const { cause } = error
return cause instanceof Error ? cause.message : undefined
}
export function ok<T>(data: T): IpcResult<T> {
return { success: true, data }
}
@@ -63,7 +68,7 @@ export function withErrorHandling<T>(
if (isBaseError(error)) {
logError(log, `[${context}] ${error.name}`, error, {
code,
cause: (error as any).cause?.message,
cause: getErrorCauseMessage(error),
handler: context
})
} else {