[Config] Improve exception messages
This commit is contained in:
parent
be384cf221
commit
187562f385
@ -102,7 +102,7 @@ class PhpFileLoader extends FileLoader
|
||||
foreach ($parameters as $parameter) {
|
||||
$reflectionType = $parameter->getType();
|
||||
if (!$reflectionType instanceof \ReflectionNamedType) {
|
||||
throw new \InvalidArgumentException(sprintf('Could not resolve argument "%s" for "%s".', $parameter->getName(), $path));
|
||||
throw new \InvalidArgumentException(sprintf('Could not resolve argument "$%s" for "%s".', $parameter->getName(), $path));
|
||||
}
|
||||
$type = $reflectionType->getName();
|
||||
|
||||
@ -121,7 +121,7 @@ class PhpFileLoader extends FileLoader
|
||||
try {
|
||||
$configBuilder = $this->configBuilder($type);
|
||||
} catch (InvalidArgumentException | \LogicException $e) {
|
||||
throw new \InvalidArgumentException(sprintf('Could not resolve argument "%s" for "%s".', $type.' '.$parameter->getName(), $path), 0, $e);
|
||||
throw new \InvalidArgumentException(sprintf('Could not resolve argument "%s" for "%s".', $type.' $'.$parameter->getName(), $path), 0, $e);
|
||||
}
|
||||
$configBuilders[] = $configBuilder;
|
||||
$arguments[] = $configBuilder;
|
||||
@ -164,7 +164,7 @@ class PhpFileLoader extends FileLoader
|
||||
|
||||
if (!$this->container->hasExtension($alias)) {
|
||||
$extensions = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s". Looked for namespace "%s", found "%s".', $namespace, $namespace, $extensions ? implode('", "', $extensions) : 'none'));
|
||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s". Looked for namespace "%s", found "%s".', $namespace, $alias, $extensions ? implode('", "', $extensions) : 'none'));
|
||||
}
|
||||
|
||||
$extension = $this->container->getExtension($alias);
|
||||
|
Reference in New Issue
Block a user