From de404102c07a0d8b4c3dd5534855cefee4813862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 24 Nov 2019 09:41:03 -0500 Subject: [PATCH] fix: #8061, don't crash if there is a network problem --- src/plugins/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/index.js b/src/plugins/index.js index 387933290f..1a04d7064a 100644 --- a/src/plugins/index.js +++ b/src/plugins/index.js @@ -170,10 +170,13 @@ function request(url, callback) { require('request')(url, { json: true, }, function (err, res, body) { + if (err) { + return callback(err); + } if (res.statusCode === 404 || !body) { - return callback(err, {}); + return callback(null, {}); } - callback(err, body); + callback(null, body); }); } const requestAsync = util.promisify(request);