Permalink
Browse files

improve exception messages in xml loader

  • Loading branch information...
1 parent 51fbffe commit 02e01b9798ed288ca41eab91edef088a2c5c966f @Tobion Tobion committed Dec 2, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/Symfony/Component/Routing/Loader/XmlFileLoader.php
View
6 src/Symfony/Component/Routing/Loader/XmlFileLoader.php
@@ -100,7 +100,7 @@ protected function parseNode(RouteCollection $collection, \DOMElement $node, $pa
$options[$n->getAttribute('key')] = trim($n->nodeValue);
break;
default:
- throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $n->tagName));
+ throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement" or "option".', $n->tagName, $file));
}
}
@@ -119,7 +119,7 @@ protected function parseNode(RouteCollection $collection, \DOMElement $node, $pa
$collection->addCollection($subCollection);
break;
default:
- throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $node->tagName));
+ throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "route" or "import".', $node->tagName, $file));
}
}
@@ -164,7 +164,7 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $definiti
$requirements[$node->getAttribute('key')] = trim($node->nodeValue);
break;
default:
- throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $node->tagName));
+ throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement" or "option".', $node->tagName, $file));
}
}

0 comments on commit 02e01b9

Please sign in to comment.