Details
Description
I have been working with the Twilio and Clickatell SMS providers, and observed that the vendor-specific SMS send functions do not return a PHP_Error object in the event of an error, contrary to the function documentation. Despite inconsistencies between the code and the function documentation, the current implementation (i.e., throwing an exception instead of returning the PHP_Error object) prevents the sendSMS function in the Activity.php file from displaying meaningful error messages to the end user.
Attached is a diff patch for this issue.
I also pushed the code to GitHub (pull request forthcoming). https://github.com/mmikitka/civicrm-core/tree/handle_pear_error_objects