4 * This file is part of the Mink package.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Mink\Exception;
13 @trigger_error('The class '.__NAMESPACE__.'\ElementException is deprecated as of Mink 1.6 and will be removed in 2.0', E_USER_DEPRECATED);
15 use Behat\Mink\Element\Element;
18 * A standard way for elements to re-throw exceptions.
20 * @deprecated This exception class is not used anymore in Mink 1.6 and will be removed in 2.0
22 * @author Chris Worfolk <xmeltrut@gmail.com>
24 class ElementException extends Exception
29 * Initialises exception.
31 * @param Element $element optional message
32 * @param \Exception $exception exception
34 public function __construct(Element $element, \Exception $exception)
36 $this->element = $element;
38 parent::__construct(sprintf("Exception thrown by %s\n%s", $element->getXpath(), $exception->getMessage()));
42 * Override default toString so we don't send a full backtrace in verbose mode.
46 public function __toString()
48 return $this->getMessage();
52 * Get the element that caused the exception.
56 public function getElement()
58 return $this->element;