Add status 404 to getMonitorById error at DB level
This commit is contained in:
1 parent
b69fc223bf
commit
bbcdc2f2a2
1 file changed
+3
-1
@@ -288,7 +288,9 @@ const getMonitorById = async (monitorId) => {
|
|||||||
try {
|
try {
|
||||||
const monitor = await Monitor.findById(monitorId);
|
const monitor = await Monitor.findById(monitorId);
|
||||||
if (monitor === null || monitor === undefined) {
|
if (monitor === null || monitor === undefined) {
|
||||||
throw new Error(errorMessages.DB_FIND_MONITOR_BY_ID(monitorId));
|
const error = new Error(errorMessages.DB_FIND_MONITOR_BY_ID(monitorId));
|
||||||
|
error.status = 404;
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
// Get notifications
|
// Get notifications
|
||||||
const notifications = await Notification.find({
|
const notifications = await Notification.find({
|
||||||
|
|||||||
Reference in new issue
Block a user