【发布时间】:2017-07-24 17:06:23
【问题描述】:
我们的代码通过执行以下操作发送 twilio 短信:
// send the text message to the member's mobile phone
try {
// attempt to send the message through Twilio
$tw_msg = $twilio_client->messages->create(
"+1".$recipient['address'],
array (
'From' => "+1".$org['twilio_number'],
'Body' => $txtmsg,
'StatusCallback' => CALLBACK_LINK.'/text_message_handler.php'
)
);
// else trap the error since the message could not be sent and the callback routine is not called
} catch (Exception $e) {
// process the text message error
process_text_msg_error($db, $e, $org, $msg, $recipient);
}
在 v4 库中,我们将通过执行以下操作获得错误代码:
// get the twilio error components
$twilio_error_status = $e->getStatus();
$twilio_error_code = $e->getCode();
$twilio_error_msg = $e->getMessage();
这并没有为我们提供使用 V5 库的预期效果。我们如何使用 V5 lib 获取错误状态和代码?
【问题讨论】:
-
当您处理错误时,您从 v5 库中得到了什么?
-
这是一个数组,我必须通过电子邮件将其发送给您。