diff --git a/src/ChainRouter.php b/src/ChainRouter.php index 6cd14b48..313baa36 100644 --- a/src/ChainRouter.php +++ b/src/ChainRouter.php @@ -203,6 +203,7 @@ private function doMatch($pathinfo, Request $request = null) $info = $request ? "this request\n$request" : "url '$pathinfo'"; + throw $methodNotAllowed ?: new ResourceNotFoundException("None of the routers in the chain matched $info"); } diff --git a/src/ContentAwareGenerator.php b/src/ContentAwareGenerator.php index 4e094dc5..d9ab5b4d 100644 --- a/src/ContentAwareGenerator.php +++ b/src/ContentAwareGenerator.php @@ -78,6 +78,7 @@ public function generate($name, $parameters = [], $absolute = UrlGeneratorInterf if (!$route instanceof SymfonyRoute) { $hint = is_object($route) ? get_class($route) : gettype($route); + throw new RouteNotFoundException('Route of this document is not an instance of Symfony\Component\Routing\Route but: '.$hint); } @@ -176,6 +177,7 @@ protected function getRouteByContent($name, &$parameters) } } else { $hint = is_object($name) ? get_class($name) : gettype($name); + throw new RouteNotFoundException("The route name argument '$hint' is not RouteReferrersReadInterface instance and there is no 'content_id' parameter"); } @@ -184,6 +186,7 @@ protected function getRouteByContent($name, &$parameters) $hint = ($this->contentRepository && $this->contentRepository->getContentId($content)) ? $this->contentRepository->getContentId($content) : get_class($content); + throw new RouteNotFoundException('Content document has no route: '.$hint); }