try catch error

This commit is contained in:
xu_yanfeng 2025-02-13 16:17:24 +08:00
parent e7283964b4
commit 2e1112f526

View File

@ -95,24 +95,28 @@ export const TipUpdate = "tip-update";
], ],
}, },
]; ];
await githubMirrorMgr.init(); try {
const data = await githubMirrorMgr.getData("version.json"); await githubMirrorMgr.init();
if (data) { const data = await githubMirrorMgr.getData("version.json");
const info = data as { ver: string }; if (data) {
const b = gt(info.ver || "0.0.0", PKG.manifest.version); const info = data as { ver: string };
if (info.ver && b) { const b = gt(info.ver || "0.0.0", PKG.manifest.version);
config.push({ if (info.ver && b) {
id: "update", config.push({
title: `${PKG.manifest.name}发现新版本${info.ver || ""}`, id: "update",
message: `点击查看`, title: `${PKG.manifest.name}发现新版本${info.ver || ""}`,
click: () => { message: `点击查看`,
goRate(); click: () => {
}, goRate();
check: async () => { },
return true; check: async () => {
}, return true;
}); },
});
}
} }
} catch (e) {
console.error(e);
} }
chrome.notifications.onClicked.addListener((id) => { chrome.notifications.onClicked.addListener((id) => {
const ret = config.find((el) => el.id === id); const ret = config.find((el) => el.id === id);