4 * This file is part of the Behat Testwork.
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\Testwork\Call\Exception;
19 * Fatal Throwable Error.
21 * @author Nicolas Grekas <p@tchwork.com>
23 class FatalThrowableError extends ErrorException
25 public function __construct(Throwable $e)
27 if ($e instanceof ParseError) {
28 $message = 'Parse error: '.$e->getMessage();
30 } elseif ($e instanceof TypeError) {
31 $message = 'Type error: '.$e->getMessage();
32 $severity = E_RECOVERABLE_ERROR;
34 $message = 'Fatal error: '.$e->getMessage();
46 $this->setTrace($e->getTrace());
49 private function setTrace($trace)
51 $traceReflector = new \ReflectionProperty('Exception', 'trace');
52 $traceReflector->setAccessible(true);
53 $traceReflector->setValue($this, $trace);