catch error for dxton

This commit is contained in:
陆柯 2021-12-11 09:52:33 +08:00
parent 2be5befb79
commit 68e4041388

View File

@ -80,6 +80,8 @@ module.exports = {
return result return result
} }
}) })
}).catch((error)=>{
return { _state: 'SMS_SEND_FAIL', error }
}) })
}, },
@ -108,16 +110,16 @@ module.exports = {
TemplateParam: JSON.stringify(msgParam), //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时。 TemplateParam: JSON.stringify(msgParam), //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时。
}) })
.then( .then(
function (res) { function (result) {
let { Code } = res let { Code } = result
if (Code === 'OK') { if (Code === 'OK') {
return { _state: 'SMS_SENT_SUCCESS' } return { _state: 'SMS_SENT_SUCCESS' }
} else { } else {
return { _state: 'SMS_SEND_FAIL', result: res } return { _state: 'SMS_SEND_FAIL', result }
} }
}, },
function (err) { function (error) {
return { _state: 'SMS_SEND_ERROR', error: err } return { _state: 'SMS_SEND_ERROR', error }
} }
) )
}, },