You are here

public function CampaignMonitor::getLatestError in Campaign Monitor 7

Returns the latest error from the stack of possible errors.

Return value

array An array containing an error code and message.

File

lib/campaignmonitor.class.inc, line 321
Implementation of the CampaignMonitor class.

Class

CampaignMonitor
Implementation of the CampaignMonitor class.

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.'),
    ];
  }
}