Skip to content

Commit e9de2aa

Browse files
authored
Replace FatalThrowableError
1 parent 2271aa7 commit e9de2aa

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/Server/Manager.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use Symfony\Component\Console\Output\ConsoleOutput;
2424
use SwooleTW\Http\Concerns\InteractsWithSwooleQueue;
2525
use SwooleTW\Http\Concerns\InteractsWithSwooleTable;
26-
use Symfony\Component\Debug\Exception\FatalThrowableError;
26+
use Symfony\Component\ErrorHandler\Error\FatalError;
2727

2828
/**
2929
* Class Manager
@@ -411,7 +411,23 @@ public function logServerError(Throwable $e)
411411
protected function normalizeException(Throwable $e)
412412
{
413413
if (! $e instanceof Exception) {
414-
$e = new FatalThrowableError($e);
414+
if ($e instanceof \ParseError) {
415+
$severity = E_PARSE;
416+
} elseif ($e instanceof \TypeError) {
417+
$severity = E_RECOVERABLE_ERROR;
418+
} else {
419+
$severity = E_ERROR;
420+
}
421+
422+
//error_get_last() syntax
423+
$error = [
424+
'type' => $severity,
425+
'message' => $e->getMessage(),
426+
'file' => $e->getFile(),
427+
'line' => $e->getLine(),
428+
];
429+
430+
$e = new FatalError($e->getMessage(), $e->getCode(), $error, null, true, $e->getTrace());
415431
}
416432

417433
return $e;

0 commit comments

Comments
 (0)