Skip to content

Commit

Permalink
Throw exception when downloading the zip archives fails
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelkost committed Jun 5, 2024
1 parent 5f4eac8 commit 819e142
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions website/download_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ function downloadFile(targetPath: string, url: string) {
const file = fs.createWriteStream(targetPath);
https.get(url, function (response) {
response.pipe(file);
if (response.statusCode != 200) {
throw Error(`HTTP Error downloading from ${url}: ${response.statusCode} ${response.statusMessage}`)
}

// after download completed close filestream
file.on("finish", () => {
Expand Down

0 comments on commit 819e142

Please sign in to comment.