From c0174dc1c49053efd28193024c1b5d2ad632afeb Mon Sep 17 00:00:00 2001 From: zhenqiang Date: Tue, 15 Aug 2023 04:14:28 +0800 Subject: [PATCH] fix(notification-aliyun-sms): throw error when sending SMS failed (#3573) --- server/notification-providers/aliyun-sms.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/notification-providers/aliyun-sms.js b/server/notification-providers/aliyun-sms.js index fa73ffb1..f0530b49 100644 --- a/server/notification-providers/aliyun-sms.js +++ b/server/notification-providers/aliyun-sms.js @@ -18,7 +18,7 @@ class AliyunSMS extends NotificationProvider { status: this.statusToString(heartbeatJSON["status"]), msg: heartbeatJSON["msg"], }); - if (this.sendSms(notification, msgBody)) { + if (await this.sendSms(notification, msgBody)) { return okMsg; } } else { @@ -28,7 +28,7 @@ class AliyunSMS extends NotificationProvider { status: "", msg: msg, }); - if (this.sendSms(notification, msgBody)) { + if (await this.sendSms(notification, msgBody)) { return okMsg; } } @@ -73,7 +73,8 @@ class AliyunSMS extends NotificationProvider { if (result.data.Message === "OK") { return true; } - return false; + + throw new Error(result.data.Message); } /**