You are here

public function CampaignMonitorManager::getLatestError in Campaign Monitor 8.2

Gets the latest error from the stack of possible errors.

Errors that were encountered during communication with CM servers.

Return value

array An array containing an error code and message.

File

src/CampaignMonitorManager.php, line 280

Class

CampaignMonitorManager
Manager for Campaignmonitor.

Namespace

Drupal\campaignmonitor

Code

public function getLatestError() {
  if (!empty($this->errors)) {
    $last = $this->errors[count($this->errors) - 1];
    return [
      'code' => $last['code'],
      'message' => $last['message'],
    ];
  }
  else {
    return [
      'code' => 1,
      'message' => $this
        ->t('There do not seem to be any errors.'),
    ];
  }
}