Skip to content

Commit

Permalink
feat: Added a 404 status check (#2272)
Browse files Browse the repository at this point in the history
In cases of 404 status messages, an html content 404 page was getting
saved to disk later showing a non-helpful error to consumers. This
should make the problem more explicit.

resolves #2271
  • Loading branch information
bmingles authored Oct 29, 2024
1 parent a71fd3d commit b552282
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/jsapi-nodejs/src/serverUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export async function downloadFromURL(
});

res.on('end', async () => {
if (res.statusCode === 404) {
reject(new Error(`File not found: "${url}"`));
return;
}

resolve(file);
});
})
Expand Down

0 comments on commit b552282

Please sign in to comment.