You are here

function _mailchimp_campaign_mcapi_error_message in Mailchimp 7.2

Same name and namespace in other branches
  1. 7.3 modules/mailchimp_campaign/mailchimp_campaign.module \_mailchimp_campaign_mcapi_error_message()

Set and log error messages after MailChimp API errors.

3 calls to _mailchimp_campaign_mcapi_error_message()
mailchimp_campaign_delete_campaign in modules/mailchimp_campaign/mailchimp_campaign.module
Delete a MailChimp campaign and the local entity.
mailchimp_campaign_save_campaign in modules/mailchimp_campaign/mailchimp_campaign.module
Save a campaign in MailChimp and as a Drupal entity.
mailchimp_campaign_send_campaign in modules/mailchimp_campaign/mailchimp_campaign.module
Send MailChimp campaign.

File

modules/mailchimp_campaign/mailchimp_campaign.module, line 346

Code

function _mailchimp_campaign_mcapi_error_message($mcapi, $message, $variables = array()) {
  $mcapiErrorMessage = 'MailChimp error code: %errorCode, MailChimp error message: %errorMessage.';
  $mcapiErrorVariables = array(
    '%errorCode' => $mcapi->errorCode,
    '%errorMessage' => $mcapi->errorMessage,
  );
  $human = t($message, $variables) . ' ' . t($mcapiErrorMessage, $mcapiErrorVariables);
  drupal_set_message($human, 'error');
  $watchdog = $message . ' ' . $mcapiErrorMessage;
  $variables = $variables + $mcapiErrorVariables;
  watchdog('mailchimp_campaign', $watchdog, $variables, WATCHDOG_ERROR);
}