fix: 修改登录报错, error改为warn

This commit is contained in:
电摇小子
2026-07-14 11:07:35 +08:00
parent d37341ab52
commit 842144eba0
+15 -11
View File
@@ -107,15 +107,17 @@ export function bootstrapWcdbNative(libPath?: string, libDirOverride?: string):
} }
} }
if (!initOk) { if (!initOk) {
throw new Error(`InitProtection 失败,错误码: ${lastCode}; tried=${resourceRoots.join(' | ')}`) console.warn(
} `[WCDB4] bootstrap InitProtection 返回 ${lastCode},继续尝试 wcdb_init/open; tried=${resourceRoots.join(' | ')}`
)
const wcdbInit = lib.func('int32 wcdb_init()') as () => number } else {
console.log('[WCDB4] bootstrap wcdb_init begin') const wcdbInit = lib.func('int32 wcdb_init()') as () => number
const initRc = Number(wcdbInit()) console.log('[WCDB4] bootstrap wcdb_init begin')
console.log(`[WCDB4] bootstrap wcdb_init rc=${initRc}`) const initRc = Number(wcdbInit())
if (initRc !== 0) { console.log(`[WCDB4] bootstrap wcdb_init rc=${initRc}`)
throw new Error(`wcdb_init 失败,错误码: ${initRc}`) if (initRc !== 0) {
console.warn(`[WCDB4] bootstrap wcdb_init 返回 ${initRc},继续尝试 wcdb_open_account`)
}
} }
wcdbBootstrapLib = lib wcdbBootstrapLib = lib
@@ -1172,7 +1174,7 @@ export class Wcdb4Client {
const initResult = wcdbInit() const initResult = wcdbInit()
console.log(`[WCDB4] wcdb_init rc=${initResult}`) console.log(`[WCDB4] wcdb_init rc=${initResult}`)
if (initResult !== 0) { 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 { private findNativeLibrary(): string {