fix(notification-dingding): throw error when failed (#3598)

This commit is contained in:
AnnAngela 2024-01-20 03:29:13 +08:00 committed by GitHub
parent 7635ab54a0
commit b4e45c7ce8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,7 +18,7 @@ class DingDing extends NotificationProvider {
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`, 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; return okMsg;
} }
} else { } else {
@ -28,7 +28,7 @@ class DingDing extends NotificationProvider {
content: msg content: msg
} }
}; };
if (this.sendToDingDing(notification, params)) { if (await this.sendToDingDing(notification, params)) {
return okMsg; return okMsg;
} }
} }
@ -59,7 +59,7 @@ class DingDing extends NotificationProvider {
if (result.data.errmsg === "ok") { if (result.data.errmsg === "ok") {
return true; return true;
} }
return false; throw new Error(result.data.errmsg);
} }
/** /**