Improved network service error handling
This commit is contained in:
1 parent
d4012e1f19
commit
59562b10c9
5 files changed
+91
-33
No files matched your search
@@ -180,6 +180,18 @@ const deleteMonitor = async (req, res, next) => {
|
||||
}
|
||||
};
|
||||
|
||||
const deleteAllMonitors = async (req, res) => {
|
||||
try {
|
||||
const deleteCount = await req.db.deleteAllMonitors();
|
||||
return res
|
||||
.status(200)
|
||||
.json({ success: true, msg: `Deleted ${deleteCount} monitors` });
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Edit a monitor by ID
|
||||
* @async
|
||||
@@ -219,5 +231,6 @@ module.exports = {
|
||||
getMonitorsByUserId,
|
||||
createMonitor,
|
||||
deleteMonitor,
|
||||
deleteAllMonitors,
|
||||
editMonitor,
|
||||
};
|
||||
Reference in new issue
Block a user