From 012aa94a879facdff5f9d5a83cd62b0f28686391 Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Wed, 8 Apr 2020 23:14:29 +0800 Subject: [PATCH] fix: handle http code 403 GitHub API doesn't return CORS headers when not ok --- src/platforms/GitHub/API.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platforms/GitHub/API.ts b/src/platforms/GitHub/API.ts index 74c2491..3777146 100644 --- a/src/platforms/GitHub/API.ts +++ b/src/platforms/GitHub/API.ts @@ -39,6 +39,7 @@ async function request( throw new Error(`Response content type is "${contentType}"`) } else { if (res.status === 404 || res.status === 401) throw new Error(errors.NOT_FOUND) + else if (res.status === 403) throw new Error(errors.API_RATE_LIMIT) else if (res.status === 500) throw new Error(errors.SERVER_FAULT) else if (isJson) { const content = await res.json()