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

Commit

Permalink
Reject promise immediately when get returns 404
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <noreply@github.com>
  • Loading branch information
Kas-tle committed Apr 30, 2023
1 parent 44659cc commit 90acd5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "enjinscraper",
"version": "1.7.2",
"version": "1.7.3",
"description": "Scrapes an Enjin site via the Enjin API",
"repository": "https://github.com/Kas-tle/EnjinScraper.git",
"author": "Joshua Castle <packages@kastle.dev",
Expand Down
4 changes: 4 additions & 0 deletions src/util/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export async function getRequest(domain: string, url: string, headers: any, debu
statusMessage(MessageType.Critical, `File is not available for download (403 Forbidden)`);
statusMessage(MessageType.Critical, `Attempt [(${retries+1}/${retryTimes+1})]`);
return Promise.reject();
} else if (error.response && error?.response.status === 404) {
statusMessage(MessageType.Critical, `File was not found (404 Not found)`);
statusMessage(MessageType.Critical, `Attempt [(${retries+1}/${retryTimes+1})]`);
return Promise.reject();
} else if (error.response && error?.response.status === 524) {
statusMessage(MessageType.Critical, `Enjin took too long to respond per Cloudflare's 100 second limit (524 a timeout occurred) Retrying...`);
statusMessage(MessageType.Critical, `Attempt [(${retries+1}/${retryTimes+1})]`);
Expand Down

0 comments on commit 90acd5e

Please sign in to comment.