Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ElementException.php

class ElementException

A standard way for elements to re-throw exceptions.

@author Chris Worfolk <xmeltrut@gmail.com>

Hierarchy

  • class \Behat\Mink\Exception\Exception extends \Behat\Mink\Exception\Exception
    • class \Behat\Mink\Exception\Exception extends \Behat\Mink\Exception\Exception
      • class \Behat\Mink\Exception\ElementException extends \Behat\Mink\Exception\Exception

Expanded class hierarchy of ElementException

Deprecated

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

File

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

Namespace

Behat\Mink\Exception
View source
class ElementException extends Exception {
    
    /**
     * @var Element
     */
    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

Title Sort descending Modifiers Object type Summary
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&#039;t send a full backtrace in verbose mode.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal