| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of the Symfony package. |
| 5 |
* |
| 6 |
* (c) Fabien Potencier <fabien@symfony.com> |
| 7 |
* |
| 8 |
* For the full copyright and license information, please view the LICENSE |
| 9 |
* file that was distributed with this source code. |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace Symfony\Component\Debug\Exception; |
| 13 |
|
| 14 |
/** |
| 15 |
* Fatal Throwable Error. |
| 16 |
* |
| 17 |
* @author Nicolas Grekas <p@tchwork.com> |
| 18 |
*/ |
| 19 |
class FatalThrowableError extends FatalErrorException |
| 20 |
{ |
| 21 |
public function __construct(\Throwable $e) |
| 22 |
{ |
| 23 |
if ($e instanceof \ParseError) { |
| 24 |
$message = 'Parse error: '.$e->getMessage(); |
| 25 |
$severity = \E_PARSE; |
| 26 |
} elseif ($e instanceof \TypeError) { |
| 27 |
$message = 'Type error: '.$e->getMessage(); |
| 28 |
$severity = \E_RECOVERABLE_ERROR; |
| 29 |
} else { |
| 30 |
$message = $e->getMessage(); |
| 31 |
$severity = \E_ERROR; |
| 32 |
} |
| 33 |
|
| 34 |
\ErrorException::__construct( |
| 35 |
$message, |
| 36 |
$e->getCode(), |
| 37 |
$severity, |
| 38 |
$e->getFile(), |
| 39 |
$e->getLine(), |
| 40 |
$e->getPrevious() |
| 41 |
); |
| 42 |
|
| 43 |
$this->setTrace($e->getTrace()); |
| 44 |
} |
| 45 |
} |
| 46 |
|