[DependencyInjection] enhanced error message

This commit is contained in:
Fabien Potencier 2011-07-06 15:26:21 +02:00
parent bb3f5c5575
commit 001af2ae4a

View File

@ -256,6 +256,15 @@ class YamlFileLoader extends FileLoader
}
if (!$this->container->hasExtension($namespace)) {
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $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',
$namespace,
$file,
$namespace,
$extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'
));
throw new \InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s).', $namespace, $file));
}
}