You are here

protected function CampaignMonitor::addError in Campaign Monitor 8

Add an error to the local stack and call watchdog, if logging is enabled.

Parameters

string $type: Drupal watchdog const. error type.

string $message: The error message.

int $code: Normally the HTTP response code.

14 calls to CampaignMonitor::addError()
CampaignMonitor::createList in src/CampaignMonitor.php
Create a new list at the Campaign Monitor servers. The side-effect is that the local cache is cleared.
CampaignMonitor::deleteList in src/CampaignMonitor.php
Delete a list from Campaign Monitor. This action can not be reverted. The list is also removed from the local cache.
CampaignMonitor::getCampaigns in src/CampaignMonitor.php
Get basic information about campaigns in the form of a keyed array. The information is stored locally in a temporary cache. The array is formatted like this:.
CampaignMonitor::getCustomFields in src/CampaignMonitor.php
Fetch custom fields for a given list, then store this information locally in the list cache. The information is stored as a keyed array on the list array under the "CustomFields" key.
CampaignMonitor::getDrafts in src/CampaignMonitor.php
Get basic information about drafts in the form of a keyed array. The information is stored locally in a temporary cache. The array is formatted like this:.

... See full list

File

src/CampaignMonitor.php, line 103
Implementation of the CampaignMonitor class, which is a wrapper class for Campaign Monitor v3 API. It's implemented as a Singleton class and instances are created using the account variables and the static function getConnector(). An example:.

Class

CampaignMonitor

Namespace

Drupal\campaignmonitor

Code

protected function addError($type, $message, $code = -1) {
  $this->errors[] = [
    'type' => $type,
    'code' => $code,
    'message' => $message,
  ];
  if ($this->logErrors) {
    $msg = t('Failed with code: @code and message: @msg', [
      '@code' => $code,
      '@msg' => $message,
    ]);
    \Drupal::logger('campaignmonitor')
      ->notice($msg);
  }
}