Add error handling to notifications
This commit is contained in:
1 parent
071a7fc9cf
commit
4d61ecfe35
1 file changed
+10
-2
@@ -16,6 +16,7 @@ class NetworkService {
|
||||
}
|
||||
|
||||
async handleNotification(monitor, isAlive) {
|
||||
try {
|
||||
let template =
|
||||
isAlive === true ? "serverIsUpTemplate" : "serverIsDownTemplate";
|
||||
let status = isAlive === true ? "up" : "down";
|
||||
@@ -33,6 +34,13 @@ class NetworkService {
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(error.message, {
|
||||
method: "handleNotification",
|
||||
service: this.SERVICE_NAME,
|
||||
monitorId: monitor._id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async handleStatusUpdate(job, isAlive) {
|
||||
@@ -42,7 +50,7 @@ class NetworkService {
|
||||
|
||||
if (monitor === null || monitor === undefined) {
|
||||
logger.error(`Null Monitor: ${_id}`, {
|
||||
method: "handleNotification",
|
||||
method: "handleStatusUpdate",
|
||||
service: this.SERVICE_NAME,
|
||||
jobId: job.id,
|
||||
});
|
||||
@@ -69,7 +77,7 @@ class NetworkService {
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(error.message, {
|
||||
method: "handleNotification",
|
||||
method: "handleStatusUpdate",
|
||||
service: this.SERVICE_NAME,
|
||||
jobId: job.id,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user