You are here

class ServicesException in Services 6.3

Same name and namespace in other branches
  1. 7.3 includes/services.runtime.inc \ServicesException

A exception thrown by services and related modules when something goes wrong.

Hierarchy

Expanded class hierarchy of ServicesException

File

./services.runtime.inc, line 13
Contains functions that only are necessary when a service call is made. This has broken out so that this code isn't loaded for every page load.

View source
class ServicesException extends Exception {
  private $data;

  /**
   * Constructor for the ServicesException.
   *
   * @param string $message
   *  Error message.
   * @param int $code
   *  Optional. Error code. This often maps to the HTTP status codes. Defaults
   *  to 0.
   * @param mixed $data
   *  Information that can be used by the server to return information about
   *  the error.
   */
  public function __construct($message, $code = 0, $data = NULL) {
    parent::__construct($message, $code);
    $this->data = !empty($data) ? $data : $message;
  }

  /**
   * Returns the data associated with the exception.
   *
   * @return mixed
   */
  public function getData() {
    return $this->data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ServicesException::$data private property
ServicesException::getData public function Returns the data associated with the exception.
ServicesException::__construct public function Constructor for the ServicesException. 1