From 779881ec6eba3fec14bde25ff04689149f7a9e2d Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Sat, 13 Jul 2024 12:01:15 +0100 Subject: [PATCH] Bugfix --- utils/get.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/utils/get.js b/utils/get.js index b8631ed..c2a3788 100644 --- a/utils/get.js +++ b/utils/get.js @@ -116,7 +116,7 @@ async function get({ key, db, query, queryValues, tableName }) { path: encodeURIComponent(path), }; - console.log("requestObject =>", requestObject); + console.log("scheme =>", scheme); (scheme?.match(/^http$/i) ? http : https) .request( @@ -135,7 +135,14 @@ async function get({ key, db, query, queryValues, tableName }) { }); response.on("end", function () { - resolve(JSON.parse(str)); + try { + resolve(JSON.parse(str)); + } catch (error) { + reject({ + error: error.message, + result: str, + }); + } }); response.on("error", (err) => {