fix: 添加错误处理以优化数据库初始化操作

This commit is contained in:
wangzhongjie 2025-03-17 14:18:47 +08:00
parent 329833c228
commit deafc59c77

View File

@ -136,13 +136,17 @@ export async function InitializeTheCentralTable(params: InitializeTheCentralTabl
}
const folderPath = await fileUtil.initFolder(`/config/tableList`);
fileUtil.addFile(`${folderPath}/${RemappingTableName[key]}.txt`, JSON.stringify(arrList))
const result = await SqlInsertTable(RemappingTableName[key], arrList)
if (!result) {
Prompt.showToast({
message: '初始化数据库失败'
})
try {
const result = await SqlInsertTable(RemappingTableName[key], arrList)
if (!result) {
Prompt.showToast({
message: '初始化数据库失败'
})
}
resolve(result)
} catch (e) {
reject(e)
}
resolve(result)
}
})
}