Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function execute(Command $command)
 {
     $handler = $this->resolver->resolve($command);
     try {
         $handler->handle($command);
     } catch (Exception $exception) {
         throw CommandException::create($exception->getMessage(), $exception);
     }
 }
Esempio n. 2
0
 /**
  * {@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);
     }
 }
 /**
  * Constructs InvalidCommandException
  *
  * @param string         $message  The exception message
  * @param int            $code     The exception code
  * @param Exception|null $previous The previous exception for chaining
  */
 public function __construct($message = '', $code = 1101, Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
 }
Esempio n. 4
0
 public function test_that_create_returns_exception_instance()
 {
     $exception = CommandException::create('Command error');
     $this->assertInstanceOf('Novuso\\Common\\Application\\Messaging\\Command\\Exception\\CommandException', $exception);
 }