You are here

class DisqusException in Disqus 7

Any unsucessful result that's created by Disqus API will generate a DisqusException.

Hierarchy

Expanded class hierarchy of DisqusException

File

./disqus.php, line 352
Provides the Disqus PHP API.

View source
class DisqusException extends Exception {

  /**
   * The information returned from the cURL call.
   */
  public $info = NULL;

  /**
   * The information returned from the Disqus call.
   */
  public $disqus = NULL;

  /**
   * Creates a DisqusException.
   * @param $message
   *   The message for the exception.
   * @param $code
   *   (optional) The error code.
   * @param $info
   *   (optional) The result from the cURL call.
   */
  public function __construct($message, $code = 0, $info = NULL, $disqus = NULL) {
    $this->info = $info;
    $this->disqus = $disqus;
    parent::__construct($message, $code);
  }

  /**
   * Converts the exception to a string.
   */
  public function __toString() {
    $code = isset($this->disqus->code) ? $this->disqus->code : (isset($info['http_code']) ? $info['http_code'] : 0);
    $message = $this
      ->getMessage();
    return __CLASS__ . ": [{$code}]: {$message}\n";
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DisqusException::$disqus public property The information returned from the Disqus call.
DisqusException::$info public property The information returned from the cURL call.
DisqusException::__construct public function Creates a DisqusException.
DisqusException::__toString public function Converts the exception to a string.