/** * {@inheritdoc} */ public function execute(Command $command) { $handler = $this->resolver->resolve($command); try { $handler->handle($command); } catch (Exception $exception) { throw CommandException::create($exception->getMessage(), $exception); } }
/** * {@inheritdoc} */ public function execute(Command $command) { try { $timetamp = DateTime::now(); $messageId = MessageId::generate(); $metaData = new MetaData(); $this->pipe(new DomainCommandMessage($messageId, $timetamp, $command, $metaData)); } catch (Exception $exception) { throw CommandException::create($exception->getMessage(), $exception); } }
public function test_that_create_returns_exception_instance() { $exception = CommandException::create('Command error'); $this->assertInstanceOf('Novuso\\Common\\Application\\Messaging\\Command\\Exception\\CommandException', $exception); }