mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
@@ -89,9 +89,9 @@ class RouterBase {
|
||||
$route->renderRoute($this->request);
|
||||
$mergedSettings = array_merge($settings, $route->getMergeableSettings());
|
||||
|
||||
// Add exceptionhandler
|
||||
// Add ExceptionHandler
|
||||
if($route->matchRoute($this->request) && $route->getExceptionHandler() !== null) {
|
||||
$this->exceptionHandlers[] = $route->getExceptionHandler();
|
||||
$this->exceptionHandlers[] = $route;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,8 +178,12 @@ class RouterBase {
|
||||
|
||||
protected function handleException(\Exception $e) {
|
||||
|
||||
foreach ($this->exceptionHandlers as $handler) {
|
||||
$handler = new $handler($this->request);
|
||||
/* @var $route RouterEntry */
|
||||
foreach ($this->exceptionHandlers as $route) {
|
||||
$route->loadMiddleware($this->request);
|
||||
$handler = $route->getExceptionHandler();
|
||||
$handler = new $handler();
|
||||
|
||||
if (!($handler instanceof IExceptionHandler)) {
|
||||
throw new RouterException('Exception handler must implement the IExceptionHandler interface.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user