Browse Source

merged branch hhamon/route_collection_better_exception_message (PR #3801)

Commits
-------

04ae7cc [Routing] fixed exception message.
f7647f9 [Routing] improved exception message when giving an invalid route name.

Discussion
----------

Route collection better exception message

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
Fabien Potencier 13 năm trước cách đây
mục cha
commit
1387415ec3
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      src/Symfony/Component/Routing/RouteCollection.php

+ 1 - 1
src/Symfony/Component/Routing/RouteCollection.php

@@ -95,7 +95,7 @@ class RouteCollection implements \IteratorAggregate
     public function add($name, Route $route)
     {
         if (!preg_match('/^[a-z0-9A-Z_.]+$/', $name)) {
-            throw new \InvalidArgumentException(sprintf('Name "%s" contains non valid characters for a route name.', $name));
+            throw new \InvalidArgumentException(sprintf('The provided route name "%s" contains non valid characters. A route name must only contain digits (0-9), letters (a-z and A-Z), underscores (_) and dots (.).', $name));
         }
 
         $parent = $this;