You are here

class ElementException in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/src/Exception/ElementException.php \Behat\Mink\Exception\ElementException

A standard way for elements to re-throw exceptions.

@author Chris Worfolk <xmeltrut@gmail.com>

Hierarchy

Expanded class hierarchy of ElementException

Deprecated

This exception class is not used anymore in Mink 1.6 and will be removed in 2.0

1 file declares its use of ElementException
ElementExceptionTest.php in vendor/behat/mink/tests/Exception/ElementExceptionTest.php

File

vendor/behat/mink/src/Exception/ElementException.php, line 24

Namespace

Behat\Mink\Exception
View source
class ElementException extends Exception {
  private $element;

  /**
   * Initialises exception.
   *
   * @param Element    $element   optional message
   * @param \Exception $exception exception
   */
  public function __construct(Element $element, \Exception $exception) {
    $this->element = $element;
    parent::__construct(sprintf("Exception thrown by %s\n%s", $element
      ->getXpath(), $exception
      ->getMessage()));
  }

  /**
   * Override default toString so we don't send a full backtrace in verbose mode.
   *
   * @return string
   */
  public function __toString() {
    return $this
      ->getMessage();
  }

  /**
   * Get the element that caused the exception.
   *
   * @return Element
   */
  public function getElement() {
    return $this->element;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ElementException::$element private property
ElementException::getElement public function Get the element that caused the exception.
ElementException::__construct public function Initialises exception.
ElementException::__toString public function Override default toString so we don't send a full backtrace in verbose mode.