Skip to content

Commit

Permalink
wrap the exception to get information about where the exception comes…
Browse files Browse the repository at this point in the history
… from
  • Loading branch information
gimler committed Jan 16, 2013
1 parent 2b3079f commit 27d9385
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -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;

/**
Expand All @@ -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)
{
Expand All @@ -39,7 +42,11 @@ public function process(ContainerBuilder $container)
foreach ($container->getAliases() as $id => $alias) {
$aliasId = (string) $alias;

$definition = $container->getDefinition($aliasId);
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;
Expand Down

0 comments on commit 27d9385

Please sign in to comment.