From 709f2e273eb31618fc3f2f48cc200a3925b199cd Mon Sep 17 00:00:00 2001 From: whwyy Date: Tue, 7 Jul 2026 15:09:39 +0800 Subject: [PATCH] eee --- kiri-engine/Application.php | 4 +++ kiri-engine/Error/ErrorHandler.php | 41 +++++++++++++++++------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/kiri-engine/Application.php b/kiri-engine/Application.php index 71797f89..c1a0fadf 100644 --- a/kiri-engine/Application.php +++ b/kiri-engine/Application.php @@ -77,6 +77,10 @@ class Application extends BaseApplication return; } $scanner = $this->container->get(Scanner::class); + $scanner->setConfig(array_merge( + config('servers.reload.scan', []), + config('site.scanner', []) + )); $scanner->scan(APP_PATH . 'app/'); } diff --git a/kiri-engine/Error/ErrorHandler.php b/kiri-engine/Error/ErrorHandler.php index 822d711d..5ecc6019 100644 --- a/kiri-engine/Error/ErrorHandler.php +++ b/kiri-engine/Error/ErrorHandler.php @@ -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 {