This commit is contained in:
2021-08-13 14:58:58 +08:00
parent 15851ba97c
commit 2432b98be5
13 changed files with 90 additions and 151 deletions
+5 -2
View File
@@ -14,7 +14,9 @@ use HttpServer\IInterface\IFormatter;
use Kiri\Abstracts\Component;
use Kiri\Core\Json;
use Kiri\Event;
use Kiri\Events\EventDispatch;
use Kiri\Kiri;
use Server\Events\OnAfterRequest;
/**
* Class ErrorHandler
@@ -74,7 +76,7 @@ class ErrorHandler extends Component implements ErrorInterface
{
$this->category = 'exception';
Event::trigger(Event::SYSTEM_RESOURCE_CLEAN);
di(EventDispatch::class)->dispatch(new OnAfterRequest());
$this->sendError($exception->getMessage(), $exception->getFile(), $exception->getLine());
}
@@ -99,7 +101,8 @@ class ErrorHandler extends Component implements ErrorInterface
Kiri::app()->error($data, 'error');
Event::trigger(Event::SYSTEM_RESOURCE_CLEAN);
di(EventDispatch::class)->dispatch(new OnAfterRequest());
throw new \ErrorException($error[1], $error[0], 1, $error[2], $error[3]);
}