Sending an SMS blast through our Twilio gateway, Twilio threw an exception which ended up being uncaught. Which is because a user unsubscribed through a text to Twilio but is still listed in the database as an active user. Why that happened is a separate issue.
But here, the issue is that even if that does happen, or even if there is some other unexpected error, SMS Blast shouldn't stop processing; in this case, the message was sent to 20 of 40 users on the list and then stopped.
The sms_blast_form_submit should instead catch the exceptions and continue processing. In my case I decided to just display the message:
foreach ($users as $user) {
try {
sms_user_send($user['uid'], $form_state['values']['message']);
} catch (Exception $e) {
drupal_set_message('Not sent to ' . $user['name']);
}
}
Unless there are other ideas, I'll prepare a patch along those lines. [Will have to adjust the count message displayed at the end of processing as well.]
Comments
Comment #1
almaudoh commentedSMS blast also fails to count the number of messages that failed to send. Always giving the erroneous impression that it sent all the messages.
Comment #2
almaudoh commentedThis issue was fixed for 7.x-1.x here #2295723: SMS Blast does not acknowledge messages that failed to send. That patch should be able to fix this issue as well.
Comment #3
dpi