Skip to content

Commit b552282

Browse files
authored
feat: Added a 404 status check (#2272)
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
1 parent a71fd3d commit b552282

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/jsapi-nodejs/src/serverUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ export async function downloadFromURL(
4545
});
4646

4747
res.on('end', async () => {
48+
if (res.statusCode === 404) {
49+
reject(new Error(`File not found: "${url}"`));
50+
return;
51+
}
52+
4853
resolve(file);
4954
});
5055
})

0 commit comments

Comments
 (0)