public passException ( Command $command, Exception $exception ) | ||
$command | Command | |
$exception | Exception |
public function passException(Command $command, \Exception $exception)
{
foreach ($this->extensions as $extensionItem) {
$extension = $extensionItem[self::EXTENSION_KEY];
if ($extension->expands($command)) {
$extension->catchException($command, $exception, $this->serviceLocator);
}
}
}
/** * @param object $command * @param callable $next */ public function execute($command, callable $next) { if ($command instanceof Command) { $this->extensionRegistry->pre($command); } try { $next($command); } catch (\Exception $exception) { $this->extensionRegistry->passException($command, $exception); throw $exception; } if ($command instanceof Command) { $this->extensionRegistry->post($command); } }