Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
Minor tweaks for previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ogizanagi committed May 31, 2019
1 parent ec2f904 commit ffea0fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions DependencyInjection/ElaoErrorNotifierExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;


/**
* ElaoErrorNotifier Extension
*/
Expand Down Expand Up @@ -46,11 +45,13 @@ public function load(array $configs, ContainerBuilder $container)
$definition->replaceArgument(0, new Reference($config['mailer']));
}

if (true === class_exists('Symfony\Component\Console\Event\ConsoleErrorEvent')) {
$definition->addTag('kernel.event_listener', ['event' => 'console.error', 'method' => 'onConsoleError', 'priority' => 0]);
if (class_exists('Symfony\Component\Console\Event\ConsoleErrorEvent')) {
$listenerTag = array('event' => 'console.error', 'method' => 'onConsoleError', 'priority' => 0);
} else {
$definition->addTag('kernel.event_listener', ['event' => 'console.exception', 'method' => 'onConsoleException', 'priority' => 0]);
$listenerTag = array('event' => 'console.exception', 'method' => 'onConsoleException', 'priority' => 0);
}

$definition->addTag('kernel.event_listener', $listenerTag);
}
}
}
2 changes: 1 addition & 1 deletion Listener/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function onKernelException(GetResponseForExceptionEvent $event)
}
}
}

/**
* Handle the console exceptions (Symfony 2.3-3.4)
*
Expand Down
1 change: 1 addition & 0 deletions Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<tag name="kernel.event_listener" event="kernel.exception" method="onKernelException" priority="0"/>
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" priority="0"/>
<tag name="kernel.event_listener" event="console.command" method="onConsoleCommand" priority="0"/>
<!-- console.exception or console.error (from bundle extension) depending on symfony/console version -->
<argument type="service" id="mailer" />
<argument type="service" id="twig" />
<argument>%kernel.cache_dir%</argument>
Expand Down

0 comments on commit ffea0fd

Please sign in to comment.