Skip to content

Commit

Permalink
fix(update): catch error on failed fetch
Browse files Browse the repository at this point in the history
Resolves #225.
  • Loading branch information
thelindat committed Jun 17, 2024
1 parent 5440e03 commit 19d55a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import fetch from 'node-fetch';
if (!currentVersion) return;

setTimeout(async () => {
const response = await fetch(`https://api.github.com/repos/overextended/oxmysql/releases/latest`);
if (response.status !== 200) return;
const response = await fetch(`https://api.github.com/repos/overextended/oxmysql/releases/latest`).catch((err) => {
console.warn(`Failed to retrieve latest version of oxmysql (${err.code}).`);
});

if (response?.status !== 200) return;

const release = (await response.json()) as any;
if (release.prerelease) return;
Expand Down

0 comments on commit 19d55a2

Please sign in to comment.