eee
This commit is contained in:
@@ -12,6 +12,7 @@ namespace Kiri\Error;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use ErrorException;
|
use ErrorException;
|
||||||
use Kiri\Abstracts\Component;
|
use Kiri\Abstracts\Component;
|
||||||
|
use Kiri\Di\Scanner;
|
||||||
use Kiri\Events\OnSystemError;
|
use Kiri\Events\OnSystemError;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
@@ -82,30 +83,30 @@ class ErrorHandler extends Component implements ErrorInterface
|
|||||||
* @throws
|
* @throws
|
||||||
* @throws
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function shutdown(): void
|
public function shutdown(): void
|
||||||
{
|
{
|
||||||
$lastError = error_get_last();
|
$lastError = error_get_last();
|
||||||
$fatalTypes = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR];
|
$fatalTypes = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR];
|
||||||
if (empty($lastError) || !in_array($lastError['type'], $fatalTypes, true)) {
|
if (empty($lastError) || !in_array($lastError['type'], $fatalTypes, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (class_exists(\Kiri\Di\Scanner::class, false)) {
|
if (class_exists(Scanner::class, false)) {
|
||||||
$scanFile = \Kiri\Di\Scanner::getCurrentFile();
|
$scanFile = Scanner::getCurrentFile();
|
||||||
if ($scanFile !== null) {
|
if ($scanFile !== null) {
|
||||||
$lastError['scanner_file'] = $scanFile;
|
$lastError['scanner_file'] = $scanFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getLogger()->println(json_encode($lastError, JSON_UNESCAPED_UNICODE));
|
$this->getLogger()->println(json_encode($lastError, JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
event(new OnSystemError());
|
event(new OnSystemError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Throwable $exception
|
* @param Throwable $exception
|
||||||
*
|
*
|
||||||
* @throws
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function exceptionHandler(Throwable $exception): void
|
public function exceptionHandler(Throwable $exception): void
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user