Merge pull request #100 from skipperbent/development

Development
This commit is contained in:
Simon Sessingø
2016-04-25 00:41:50 +02:00
+8 -4
View File
@@ -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.');
}