Fixing errors and warnings

This commit is contained in:
2019-12-03 20:26:31 -05:00
parent 7c7256acbd
commit 72d099e05e
9 changed files with 62 additions and 30 deletions

View File

@@ -153,8 +153,8 @@ exports.quoteWithoutPost = (req, res) => {
}
})
.catch((err) => {
return res.status(500).json({error: 'Something is wrong'});
// return res.status(500).json({error: 'Something is wrong'});
return res.status(500).json({error: err});
})
}
@@ -195,7 +195,8 @@ exports.likePost = (req, res) => {
}
})
.catch((err) => {
return res.status(500).json({error: 'Something is wrong'});
// return res.status(500).json({error: 'Something is wrong'});
return res.status(500).json({error: err});
})
}

View File

@@ -1,4 +1,5 @@
/* eslint-disable promise/catch-or-return */
/* eslint-disable promise/always-return */
const { admin, db } = require("../util/admin");
const config = require("../util/config");
const { validateUpdateProfileInfo } = require("../util/validator");
@@ -304,12 +305,19 @@ exports.deleteUser = (req, res) => {
})
.then(() => {
resolve();
return;
})
.catch((err) => {
console.log("error " + err);
reject(err);
return;
})
})
.catch((err) => {
console.log(err);
return res.status(500).json({error: err});
})
})
}
@@ -327,10 +335,12 @@ exports.deleteUser = (req, res) => {
})
.then(() => {
resolve();
return;
})
.catch((err) => {
console.log(err);
reject(err);
return;
})
})
@@ -558,7 +568,11 @@ exports.addSubscription = (req, res) => {
return res.status(500).json({ err });
});
return res.status(500).json({ error: "shouldn't execute" });
});
})
.catch((err) => {
console.log(err);
return res.status(500).json({error: err});
})
};
exports.getSubs = (req, res) => {
@@ -598,5 +612,9 @@ exports.removeSub = (req, res) => {
return res.status(500).json({ err });
});
return res.status(500).json({ error: "shouldn't execute" });
});
})
.catch((err) => {
console.log(err);
return res.status(500).json({error: err});
})
};