This commit is contained in:
Tben 2023-05-22 09:41:53 +01:00
parent b1b1d3c193
commit 6325f0d064
2 changed files with 16 additions and 3 deletions

View File

@ -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": {

View File

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