From d04cf0ad3a5bf9b3427f5e66c75cc2c44ac098b1 Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Thu, 10 Mar 2016 15:52:02 +0800 Subject: [PATCH] Properly fail if icon is not found by pageicon --- src/infer/inferIcon.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/infer/inferIcon.js b/src/infer/inferIcon.js index 0d7bb2d..6700ee9 100644 --- a/src/infer/inferIcon.js +++ b/src/infer/inferIcon.js @@ -19,6 +19,9 @@ function inferIconFromUrlToPath(targetUrl, platform, outDir, callback) { pageIcon(targetUrl, {ext: preferredExt}) .then(icon => { + if (!icon) { + throw 'Icon not found'; + } const outfilePath = path.join(outDir, `/icon.${icon.ext}`); fs.writeFile(outfilePath, icon.data, error => { callback(error, outfilePath);