improvement: better error handling

This commit is contained in:
canove
2020-09-04 17:09:39 -03:00
parent 3cb3fc1a20
commit f7fe3286b8
23 changed files with 166 additions and 532 deletions

View File

@@ -38,9 +38,6 @@ const setMessagesAsRead = async ticket => {
};
exports.index = async (req, res, next) => {
// const wbot = getWbot();
// const io = getIO();
const { ticketId } = req.params;
const { searchParam = "", pageNumber = 1 } = req.query;
@@ -125,6 +122,10 @@ exports.store = async (req, res, next) => {
],
});
if (!ticket) {
return res.status(404).json({ error: "No ticket found with this ID" });
}
try {
if (media) {
const newMedia = MessageMedia.fromFilePath(req.file.path);