فهرست منبع

[DependencyInjection] enhanced error message

Fabien Potencier 14 سال پیش
والد
کامیت
001af2ae4a
1فایلهای تغییر یافته به همراه9 افزوده شده و 0 حذف شده
  1. 9 0
      src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

+ 9 - 0
src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

@@ -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));
             }
         }