You are here

public function CampaignMonitor::getLatestError in Campaign Monitor 8

Returns the latest error from the stack of possible errors encountered during communication with Campaign Monitor servers.

Return value

array An array containing an error code and message.

File

src/CampaignMonitor.php, line 203
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

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' => t('There do not seem to be any errors.'),
    ];
  }
}