Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Commit 87aebd3

Browse files
authored
Merge pull request #453 from lagerroos/master
Reverted missing fixes PR #417 on FatalThrowableError missing
2 parents 714cb6d + 9bc3fa8 commit 87aebd3

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/Server/Manager.php

Lines changed: 17 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,22 @@ 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 = [
423+
'type' => $severity,
424+
'message' => $e->getMessage(),
425+
'file' => $e->getFile(),
426+
'line' => $e->getLine(),
427+
];
428+
429+
$e = new FatalError($e->getMessage(), $e->getCode(), $error, null, true, $e->getTrace());
415430
}
416431

417432
return $e;

0 commit comments

Comments
 (0)