diff --git a/apps/common/message/backends/sms/tencent.py b/apps/common/message/backends/sms/tencent.py index 427e8b7dd..40fcad9dc 100644 --- a/apps/common/message/backends/sms/tencent.py +++ b/apps/common/message/backends/sms/tencent.py @@ -82,6 +82,15 @@ class TencentSMS(BaseSMSClient): resp = self.client.SendSms(req) + try: + code = resp.SendStatusSet[0].Code + msg = resp.SendStatusSet[0].Message + except IndexError: + raise JMSException(code='response_bad', detail=resp) + + if code.lower() != 'ok': + raise JMSException(code=code, detail=msg) + return resp except TencentCloudSDKException as e: raise JMSException(code=e.code, detail=e.message)