From 7f8ace2ec33b1081fd20bb7ef3e7214d9b6f9de9 Mon Sep 17 00:00:00 2001 From: Aman Karmani Date: Thu, 21 Oct 2021 09:08:53 -0700 Subject: [PATCH] handle http errors --- PlutoIPTV/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PlutoIPTV/index.js b/PlutoIPTV/index.js index 148d4b7..5c004ed 100755 --- a/PlutoIPTV/index.js +++ b/PlutoIPTV/index.js @@ -264,7 +264,11 @@ const plutoIPTV = { promises.push( new Promise((resolve, reject) => { request(url, function (err, code, raw) { - resolve(JSON.parse(raw)); + if (err) { + reject(err); + } else { + resolve(JSON.parse(raw)); + } }); }) );