Skip to content

Commit

Permalink
Make the route name error more helpful
Browse files Browse the repository at this point in the history
As a developer I have no clue what "Invalid route name" means. If the
exception gives me a hint I might find it easier to figure out why my
route triggers this error.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Oct 22, 2021
1 parent e75d226 commit e36823f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/private/AppFramework/Routing/RouteConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function processRoute(array $route, string $routeNamePrefix = ''): voi

$split = explode('#', $name, 2);
if (count($split) !== 2) {
throw new \UnexpectedValueException('Invalid route name');
throw new \UnexpectedValueException('Invalid route name: use the format foo#bar to reference FooController::bar');
}
[$controller, $action] = $split;

Expand Down
2 changes: 1 addition & 1 deletion lib/private/AppFramework/Routing/RouteParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private function processRoute(array $route, string $appName, string $routeNamePr

$split = explode('#', $name, 2);
if (count($split) !== 2) {
throw new \UnexpectedValueException('Invalid route name');
throw new \UnexpectedValueException('Invalid route name: use the format foo#bar to reference FooController::bar');
}
[$controller, $action] = $split;

Expand Down

0 comments on commit e36823f

Please sign in to comment.