refactor(logging): when notify is true send the error to systemAdmins
This commit is contained in:
@@ -23,7 +23,7 @@ const reprint = async (data: any, emails: string) => {
|
||||
module: "notification",
|
||||
subModule: "query",
|
||||
message: `${data.name} encountered an error while trying to get initial info`,
|
||||
data: [le],
|
||||
data: le as any,
|
||||
notify: true,
|
||||
});
|
||||
}
|
||||
@@ -52,7 +52,7 @@ const reprint = async (data: any, emails: string) => {
|
||||
module: "notification",
|
||||
subModule: "query",
|
||||
message: `Data for: ${l[0].name} encountered an error while trying to get it`,
|
||||
data: [error],
|
||||
data: error as any,
|
||||
notify: true,
|
||||
});
|
||||
}
|
||||
@@ -73,7 +73,7 @@ const reprint = async (data: any, emails: string) => {
|
||||
module: "notification",
|
||||
subModule: "query",
|
||||
message: `Data for: ${l[0].name} encountered an error while trying to get it`,
|
||||
data: [dbe],
|
||||
data: dbe as any,
|
||||
notify: true,
|
||||
});
|
||||
}
|
||||
@@ -90,22 +90,13 @@ const reprint = async (data: any, emails: string) => {
|
||||
});
|
||||
|
||||
if (!sentEmail?.success) {
|
||||
// sendEmail({
|
||||
// email: "Blake.matths@alpla.com",
|
||||
// subject: `${os.hostname()} failed to run ${data[0]?.name}.`,
|
||||
// template: "serverCrash",
|
||||
// context: {
|
||||
// error: sentEmail?.data,
|
||||
// plant: `${os.hostname()}`,
|
||||
// },
|
||||
// });
|
||||
return returnFunc({
|
||||
success: false,
|
||||
level: "error",
|
||||
module: "notification",
|
||||
subModule: "email",
|
||||
message: `${l[0].name} failed to send the email`,
|
||||
data: [sentEmail?.data],
|
||||
data: sentEmail?.data as any,
|
||||
notify: true,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user