You are here

class MailchimpAPIException in Mailchimp 8

Custom Mailchimp API exception.

@package Mailchimp

Hierarchy

Expanded class hierarchy of MailchimpAPIException

5 files declare their use of MailchimpAPIException
MailchimpAdminSettingsForm.php in src/Form/MailchimpAdminSettingsForm.php
MailchimpCampaignController.php in modules/mailchimp_campaign/src/Controller/MailchimpCampaignController.php
MailchimpEcommerce.php in lib/mailchimp-api-php/tests/src/MailchimpEcommerce.php
MailchimpGuzzleHttpClient.php in lib/mailchimp-api-php/src/http/MailchimpGuzzleHttpClient.php
MailchimpTestHttpClient.php in lib/mailchimp-api-php/tests/src/MailchimpTestHttpClient.php

File

lib/mailchimp-api-php/src/MailchimpAPIException.php, line 12

Namespace

Mailchimp
View source
class MailchimpAPIException extends Exception {

  /**
   * @inheritdoc
   */
  public function __construct($message = "", $code = 0, Exception $previous = NULL) {

    // Construct message from JSON if required.
    if (substr($message, 0, 1) == '{') {
      $message_obj = json_decode($message);
      $message = $message_obj->status . ': ' . $message_obj->title . ' - ' . $message_obj->detail;
      if (!empty($message_obj->errors)) {
        $message .= ' ' . serialize($message_obj->errors);
      }
    }
    parent::__construct($message, $code, $previous);
  }

}

Members