Skip to content

Commit

Permalink
Better exception message for extension in XmlFileLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
lstrojny committed Jul 5, 2011
1 parent f562e60 commit 133169f
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -382,7 +382,19 @@ private function validateExtensions(\DOMDocument $dom, $file)

// can it be handled by an extension?
if (!$this->container->hasExtension($node->namespaceURI)) {
throw new \InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s).', $node->tagName, $file));
$extensionNamespaces = array_filter(array_map(
function($ext) {
return $ext->getNamespace();
},
$this->container->getExtensions()
));
throw new \InvalidArgumentException(sprintf(
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
$node->tagName,
$file,
$node->namespaceURI,
$extensionNamespaces ? '"' . join($extensionNamespaces, '", "') . '"' : 'none'
));
}
}
}
Expand Down

0 comments on commit 133169f

Please sign in to comment.