From 842144eba01c4467411faf8690f300e7872f67c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B5=E6=91=87=E5=B0=8F=E5=AD=90?= Date: Mon, 13 Jul 2026 09:52:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=8A=A5=E9=94=99,=20error=E6=94=B9=E4=B8=BAwarn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/wcdb4-client.ts | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/wcdb4-client.ts b/src/main/wcdb4-client.ts index e8f718b..40cc14f 100644 --- a/src/main/wcdb4-client.ts +++ b/src/main/wcdb4-client.ts @@ -107,15 +107,17 @@ export function bootstrapWcdbNative(libPath?: string, libDirOverride?: string): } } if (!initOk) { - throw new Error(`InitProtection 失败,错误码: ${lastCode}; tried=${resourceRoots.join(' | ')}`) - } - - const wcdbInit = lib.func('int32 wcdb_init()') as () => number - console.log('[WCDB4] bootstrap wcdb_init begin') - const initRc = Number(wcdbInit()) - console.log(`[WCDB4] bootstrap wcdb_init rc=${initRc}`) - if (initRc !== 0) { - throw new Error(`wcdb_init 失败,错误码: ${initRc}`) + console.warn( + `[WCDB4] bootstrap InitProtection 返回 ${lastCode},继续尝试 wcdb_init/open; tried=${resourceRoots.join(' | ')}` + ) + } else { + const wcdbInit = lib.func('int32 wcdb_init()') as () => number + console.log('[WCDB4] bootstrap wcdb_init begin') + const initRc = Number(wcdbInit()) + console.log(`[WCDB4] bootstrap wcdb_init rc=${initRc}`) + if (initRc !== 0) { + console.warn(`[WCDB4] bootstrap wcdb_init 返回 ${initRc},继续尝试 wcdb_open_account`) + } } wcdbBootstrapLib = lib @@ -1172,7 +1174,7 @@ export class Wcdb4Client { const initResult = wcdbInit() console.log(`[WCDB4] wcdb_init rc=${initResult}`) if (initResult !== 0) { - throw new Error(`wcdb_init 失败,错误码: ${initResult}`) + console.warn(`[WCDB4] wcdb_init 返回 ${initResult},继续尝试 wcdb_open_account`) } } @@ -1354,7 +1356,9 @@ export class Wcdb4Client { } } - throw new Error(`InitProtection 失败,错误码: ${lastCode}; tried=${resourceRoots.join(' | ')}`) + console.warn( + `[WCDB4] InitProtection 返回 ${lastCode},继续尝试 wcdb_init/open; tried=${resourceRoots.join(' | ')}` + ) } private findNativeLibrary(): string {