fix: add notifications to all updater failure paths for diagnostics
All checks were successful
Build & Release / build (push) Successful in 2m55s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MiTHRAL 2026-04-21 15:50:23 -04:00
parent 581a853b6f
commit c828a6af47

View file

@ -24,18 +24,32 @@ interface Release {
export async function checkForUpdates() { export async function checkForUpdates() {
try { try {
console.log("[updater] checking:", RELEASES_URL);
notify("Checking for Updates", "Looking for a new version of Sanctum…");
const res = await fetch(RELEASES_URL); const res = await fetch(RELEASES_URL);
if (!res.ok) return; if (!res.ok) {
console.error("[updater] releases API returned", res.status, res.statusText);
notify("Update Check Failed", `API returned ${res.status} — check console.`);
return;
}
const release = (await res.json()) as Release; const release = (await res.json()) as Release;
const latest = release.tag_name.replace(/^v/, ""); const latest = release.tag_name.replace(/^v/, "");
const current = app.getVersion(); const current = app.getVersion();
if (!isNewer(latest, current)) return; console.log(`[updater] current=${current} latest=${latest}`);
if (!isNewer(latest, current)) {
notify("Already Up to Date", `You're on Sanctum ${current}.`);
return;
}
const asset = findAsset(release.assets); const asset = findAsset(release.assets);
if (!asset) { if (!asset) {
console.error("[updater] no matching asset found for platform:", process.platform, release.assets.map(a => a.name)); const names = release.assets.map(a => a.name).join(", ");
console.error("[updater] no matching asset for platform:", process.platform, names);
notify("Update Failed", `No ${process.platform} asset found. Assets: ${names}`);
return; return;
} }
@ -44,6 +58,7 @@ export async function checkForUpdates() {
await downloadAndInstall(asset.browser_download_url, latest); await downloadAndInstall(asset.browser_download_url, latest);
} catch (err) { } catch (err) {
console.error("[updater] update check failed:", err); console.error("[updater] update check failed:", err);
notify("Update Check Failed", String(err));
} }
} }