function constant_contact_display_last_error in Constant Contact 6.3
Same name and namespace in other branches
- 7.3 constant_contact.module \constant_contact_display_last_error()
This function is used to determine what the last error was and displays a friendly error message
1 call to constant_contact_display_last_error()
- constant_contact_user in ./
constant_contact.module - This method adds extra functionality to the user methods Create, Update, Delete
File
- ./
constant_contact.module, line 1156
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 processing your request, the error given was: ';
switch ($status_code) {
case 400:
/* Invalid Request */
$last_error .= 'Invalid Request';
break;
case 401:
/* Unauthorized */
$last_error .= 'Unauthorized';
break;
case 404:
/* Page Not Found */
$last_error .= 'Page Not Found';
break;
case 409:
/* Conflict */
$last_error .= 'Conflict';
break;
case 415:
/* Unsupported Media Type */
$last_error .= 'Unsupported Media Type';
break;
case 500:
/* Internal Server Error */
$last_error .= 'Internal Server Error';
break;
default:
/* Unknown Error */
$last_error .= 'Unknown Error';
break;
}
watchdog('Constant Contact', '%error', array(
'%error' => $last_error,
), WATCHDOG_ERROR);
drupal_set_message($last_error, 'error');
}