From b4e45c7ce8ceb47d55c2ab41310852f052227047 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Sat, 20 Jan 2024 03:29:13 +0800 Subject: [PATCH] fix(notification-dingding): throw error when failed (#3598) --- server/notification-providers/dingding.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/notification-providers/dingding.js b/server/notification-providers/dingding.js index cea0b0a1e..8f4bd4826 100644 --- a/server/notification-providers/dingding.js +++ b/server/notification-providers/dingding.js @@ -18,7 +18,7 @@ class DingDing extends NotificationProvider { text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`, } }; - if (this.sendToDingDing(notification, params)) { + if (await this.sendToDingDing(notification, params)) { return okMsg; } } else { @@ -28,7 +28,7 @@ class DingDing extends NotificationProvider { content: msg } }; - if (this.sendToDingDing(notification, params)) { + if (await this.sendToDingDing(notification, params)) { return okMsg; } } @@ -59,7 +59,7 @@ class DingDing extends NotificationProvider { if (result.data.errmsg === "ok") { return true; } - return false; + throw new Error(result.data.errmsg); } /**