Skip to content

Commit

Permalink
Fixed error handling of ModelNotFoundException and PageNotFoundExcept…
Browse files Browse the repository at this point in the history
…ion exceptions
  • Loading branch information
simba77 committed Feb 5, 2024
1 parent a1d74f9 commit f57e3ca
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions system/src/Router/RequestHandler.php
Expand Up @@ -47,15 +47,14 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}

$this->middlewareDispatcher->addMiddleware($this);
return $this->middlewareDispatcher->handle($request);
} catch (ResourceNotFoundException) {
return status_page(404);
} catch (ModelNotFoundException $exception) {
return status_page(404, message: $exception->getMessage());
} catch (PageNotFoundException $exception) {
return status_page(404, template: $exception->getTemplate(), title: $exception->getTitle(), message: $exception->getMessage());
}

return $this->middlewareDispatcher->handle($request);
}

/**
Expand Down

0 comments on commit f57e3ca

Please sign in to comment.