diff --git a/src/Illuminate/Routing/UrlGenerator.php b/src/Illuminate/Routing/UrlGenerator.php index dac9c06b257b..9d360f651c5d 100755 --- a/src/Illuminate/Routing/UrlGenerator.php +++ b/src/Illuminate/Routing/UrlGenerator.php @@ -518,6 +518,8 @@ protected function getRouteScheme($route) * @param mixed $parameters * @param bool $absolute * @return string + * + * @throws \InvalidArgumentException */ public function action($action, $parameters = array(), $absolute = true) { @@ -529,8 +531,13 @@ public function action($action, $parameters = array(), $absolute = true) { $action = trim($action, '\\'); } - - return $this->toRoute($this->routes->getByAction($action), $parameters, $absolute); + + if ( ! is_null($route = $this->routes->getByAction($action))) + { + return $this->toRoute($route, $parameters, $absolute); + } + + throw new InvalidArgumentException("Action {$action} not defined."); } /**