From 6325f0d064fd815351c3c1a35a1cc2ce25bae45b Mon Sep 17 00:00:00 2001 From: Tben <52448020+BenjaminToby@users.noreply.github.com> Date: Mon, 22 May 2023 09:41:53 +0100 Subject: [PATCH] updates --- package.json | 2 +- utils/post.js | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 071827a..19590ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.1.11", + "version": "1.1.12", "description": "Cloud-based SQL data management tool", "main": "index.js", "scripts": { diff --git a/utils/post.js b/utils/post.js index 645d60c..77d554e 100644 --- a/utils/post.js +++ b/utils/post.js @@ -75,11 +75,24 @@ module.exports = async function ({ key, query, database }) { }); response.on("end", function () { - resolve(JSON.parse(str)); + try { + resolve(JSON.parse(str)); + } catch (error) { + console.log(error); + resolve({ + success: false, + payload: null, + error: error.message, + }); + } }); response.on("error", (err) => { - reject(err); + resolve({ + success: false, + payload: null, + error: err.message, + }); }); } );