Skip to content

Commit 3ab80d5

Browse files
committed
add error message for rate limited api responses
1 parent d6a084b commit 3ab80d5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,16 @@ class Updates {
5555
const url = `https://api.github.com/repos/${account}/${repository}/releases?per_page=100`
5656
const headers = { Accept: 'application/vnd.github.preview' }
5757
const res = await fetch(url, { headers })
58-
if (res.status >= 400) return
58+
59+
if (res.status === 403) {
60+
console.error('Rate Limited!')
61+
return
62+
}
63+
64+
if (res.status >= 400) {
65+
return
66+
}
67+
5968
const releases = await res.json()
6069
for (const release of releases) {
6170
for (const asset of release.assets) {

0 commit comments

Comments
 (0)