function constant_contact_display_last_error in Constant Contact 7.3
Same name and namespace in other branches
- 6.3 constant_contact.module \constant_contact_display_last_error()
Display a friendly last error message.
2 calls to constant_contact_display_last_error()
- constant_contact_user_insert in ./
constant_contact.module - Implements hook_user_insert().
- constant_contact_user_update in ./
constant_contact.module - Implements hook_update_user().
File
- ./
constant_contact.module, line 1319
Code
function constant_contact_display_last_error($status_code = 0) {
$last_error = '';
$status_code = intval($status_code);
if (!$status_code) {
return $last_error;
}
$last_error = 'Sorry there was a problem communicating with the constant contact server, the error given was: ';
switch ($status_code) {
case 400:
$last_error .= 'Invalid Request';
break;
case 401:
$last_error .= 'Unauthorized';
break;
case 404:
$last_error .= 'Page Not Found';
break;
case 409:
$last_error .= 'Conflict';
break;
case 415:
$last_error .= 'Unsupported Media Type';
break;
case 500:
$last_error .= 'Internal Server Error';
break;
default:
$last_error .= 'Unknown Error';
break;
}
watchdog('Constant Contact', '%error', array(
'%error' => $last_error,
), WATCHDOG_ERROR);
drupal_set_message(t('Error: %last_error', array(
'%last_error' => $last_error,
)), 'error');
}