wrap the exception to get information about where the exception comes from
This commit is contained in:
parent
2b3079f948
commit
27d9385d4d
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
@ -30,6 +31,8 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
|
||||
* Process the Container to replace aliases with service definitions.
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
*
|
||||
* @throws InvalidArgumentException if the service definition does not exist
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
@ -39,7 +42,11 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
|
||||
foreach ($container->getAliases() as $id => $alias) {
|
||||
$aliasId = (string) $alias;
|
||||
|
||||
try {
|
||||
$definition = $container->getDefinition($aliasId);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with "%s".', $alias, $id), null, $e);
|
||||
}
|
||||
|
||||
if ($definition->isPublic()) {
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user