Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Add an error handler for ratelimits.
Browse files Browse the repository at this point in the history
  • Loading branch information
reisxd committed Jul 4, 2022
1 parent ca946a2 commit 9f4db83
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ async function getDownloadLink (json) {
`https://api.github.com/repos/${json.owner}/${json.repo}/releases/latest`
);
const jsonResponse = await apiRequest.json();
if (jsonResponse.error) {
throw new Error('Looks like you got ratelimited.\nTry waiting 30 minutes.');
}
return jsonResponse.assets;
}

Expand Down Expand Up @@ -184,7 +187,9 @@ async function downloadFile (assets) {
asset.browser_download_url.split('/').pop() !==
'app-release-unsigned.apk'
) {
if (asset.browser_download_url.split('/').pop() !== 'microg.apk') { continue; }
if (asset.browser_download_url.split('/').pop() !== 'microg.apk') {
continue;
}
}
}
await dloadFromURL(
Expand Down

0 comments on commit 9f4db83

Please sign in to comment.