You are here

protected function CampaignMonitorManager::addError in Campaign Monitor 8.2

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

Parameters

string $message: The error message.

int $code: Normally the HTTP response code.

14 calls to CampaignMonitorManager::addError()
CampaignMonitorManager::createList in src/CampaignMonitorManager.php
Create a new list at the Campaign Monitor servers.
CampaignMonitorManager::deleteList in src/CampaignMonitorManager.php
Delete a list from Campaign Monitor.
CampaignMonitorManager::getCampaigns in src/CampaignMonitorManager.php
Get basic information about campaigns in the form of a keyed array.
CampaignMonitorManager::getCustomFields in src/CampaignMonitorManager.php
Fetch custom fields for a given list.
CampaignMonitorManager::getDrafts in src/CampaignMonitorManager.php
Get basic information about drafts in the form of a keyed array.

... See full list

File

src/CampaignMonitorManager.php, line 181

Class

CampaignMonitorManager
Manager for Campaignmonitor.

Namespace

Drupal\campaignmonitor

Code

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