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();
|
const notification = await new Notification({ ...notificationData }).save();
|
||||||
return notification;
|
return notification;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
error.service = SERVICE_NAME;
|
||||||
|
error.method = "createNotification";
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -30,6 +32,8 @@ const getNotificationsByMonitorId = async (monitorId) => {
|
|||||||
const notifications = await Notification.find({ monitorId });
|
const notifications = await Notification.find({ monitorId });
|
||||||
return notifications;
|
return notifications;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
error.service = SERVICE_NAME;
|
||||||
|
error.method = "getNotificationsByMonitorId";
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -39,6 +43,8 @@ const deleteNotificationsByMonitorId = async (monitorId) => {
|
|||||||
const result = await Notification.deleteMany({ monitorId });
|
const result = await Notification.deleteMany({ monitorId });
|
||||||
return result.deletedCount;
|
return result.deletedCount;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
error.service = SERVICE_NAME;
|
||||||
|
error.method = "deleteNotificationsByMonitorId";
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ const createPageSpeedCheck = async (pageSpeedCheckData) => {
|
|||||||
}).save();
|
}).save();
|
||||||
return pageSpeedCheck;
|
return pageSpeedCheck;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
error.service = SERVICE_NAME;
|
||||||
|
error.method = "createPageSpeedCheck";
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -36,6 +38,8 @@ const getPageSpeedChecks = async (monitorId) => {
|
|||||||
const pageSpeedChecks = await PageSpeedCheck.find({ monitorId });
|
const pageSpeedChecks = await PageSpeedCheck.find({ monitorId });
|
||||||
return pageSpeedChecks;
|
return pageSpeedChecks;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
error.service = SERVICE_NAME;
|
||||||
|
error.method = "getPageSpeedChecks";
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -53,6 +57,8 @@ const deletePageSpeedChecksByMonitorId = async (monitorId) => {
|
|||||||
const result = await PageSpeedCheck.deleteMany({ monitorId });
|
const result = await PageSpeedCheck.deleteMany({ monitorId });
|
||||||
return result.deletedCount;
|
return result.deletedCount;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
error.service = SERVICE_NAME;
|
||||||
|
error.method = "deletePageSpeedChecksByMonitorId";
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user