Add service name and method name to errors in notification and pageSpeedCheck modules
This commit is contained in:
1 parent
f5fb32885e
commit
b4fd895ea2
2 files changed
+12
No files matched your search
@@ -15,6 +15,8 @@ const createNotification = async (notificationData) => {
|
||||
const notification = await new Notification({ ...notificationData }).save();
|
||||
return notification;
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "createNotification";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -30,6 +32,8 @@ const getNotificationsByMonitorId = async (monitorId) => {
|
||||
const notifications = await Notification.find({ monitorId });
|
||||
return notifications;
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "getNotificationsByMonitorId";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -39,6 +43,8 @@ const deleteNotificationsByMonitorId = async (monitorId) => {
|
||||
const result = await Notification.deleteMany({ monitorId });
|
||||
return result.deletedCount;
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "deleteNotificationsByMonitorId";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user