This commit is contained in:
2026-07-07 15:09:39 +08:00
parent 536e4c9bc5
commit 709f2e273e
2 changed files with 28 additions and 17 deletions
+24 -17
View File
@@ -82,23 +82,30 @@ class ErrorHandler extends Component implements ErrorInterface
* @throws
* @throws
*/
public function shutdown(): void
{
$lastError = error_get_last();
if (empty($lastError) || $lastError['type'] !== E_ERROR) {
return;
}
$this->getLogger()->println(json_encode($lastError,JSON_UNESCAPED_UNICODE));
event(new OnSystemError());
}
/**
* @param Throwable $exception
*
* @throws
public function shutdown(): void
{
$lastError = error_get_last();
$fatalTypes = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR];
if (empty($lastError) || !in_array($lastError['type'], $fatalTypes, true)) {
return;
}
if (class_exists(\Kiri\Di\Scanner::class, false)) {
$scanFile = \Kiri\Di\Scanner::getCurrentFile();
if ($scanFile !== null) {
$lastError['scanner_file'] = $scanFile;
}
}
$this->getLogger()->println(json_encode($lastError, JSON_UNESCAPED_UNICODE));
event(new OnSystemError());
}
/**
* @param Throwable $exception
*
* @throws
*/
public function exceptionHandler(Throwable $exception): void
{