Merge pull request #296 from skipperbent/v3

V3
This commit is contained in:
Simon Sessingø
2017-10-07 17:53:27 +02:00
committed by GitHub
+19 -13
View File
@@ -329,25 +329,31 @@ class Router
throw new HttpException('Exception handler must implement the IExceptionHandler interface.', 500); throw new HttpException('Exception handler must implement the IExceptionHandler interface.', 500);
} }
if ($handler->handleError($this->request, $e) !== null) { try {
$rewriteRoute = $this->request->getRewriteRoute(); if ($handler->handleError($this->request, $e) !== null) {
if ($rewriteRoute !== null) { $rewriteRoute = $this->request->getRewriteRoute();
$rewriteRoute->loadMiddleware($this->request);
return $rewriteRoute->renderRoute($this->request); if ($rewriteRoute !== null) {
$rewriteRoute->loadMiddleware($this->request);
return $rewriteRoute->renderRoute($this->request);
}
$rewriteUrl = $this->request->getRewriteUrl();
/* If the request has changed */
if ($rewriteUrl !== null && $rewriteUrl !== $url) {
unset($this->exceptionHandlers[$i]);
$this->exceptionHandlers = array_values($this->exceptionHandlers);
return $this->routeRequest(true);
}
} }
$rewriteUrl = $this->request->getRewriteUrl(); } catch (\Exception $e) {
/* If the request has changed */
if ($rewriteUrl !== null && $rewriteUrl !== $url) {
unset($this->exceptionHandlers[$i]);
$this->exceptionHandlers = array_values($this->exceptionHandlers);
return $this->routeRequest(true);
}
} }
} }