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, + }); }); } );