From ed48599aa972ea4b822353c47b614f67a019bd56 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Tue, 11 Sep 2018 15:18:32 -0500 Subject: [PATCH] downloadFile should callback w/ err msg if response code is not 200 --- lib/utils/utils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 7ccbc620a..e32cd2f5a 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -160,6 +160,9 @@ function downloadFile(url, dest, cb) { const o_fs = require('fs-extra'); var file = o_fs.createWriteStream(dest); (url.substring(0, 5) === 'https' ? https : http).get(url, function (response) { + if (response.statusCode !== 200) { + if (cb) cb(`Download failed, response code ${response.statusCode}`); + } response.pipe(file); file.on('finish', function () { file.close(cb);