Exemplo n.º 1
0
 public async Task SendAsync(Type commandType, ICommand command)
 {
     try
     {
         await commandsBus.SendAsync(commandType, command);
     }
     catch (NonGenericException e) when(command is Command)
     {
         await eventsBus.Publish(CommandExceptionEvent.FromCommand(command as Command, e));
     }
     catch when(command is Command)
         {
             await eventsBus.Publish(CommandExceptionEvent.FromCommand(command as Command, "Unknown error. Please try again."));
         }
 }
Exemplo n.º 2
0
 public async Task SendAsync <TCommand>(TCommand command) where TCommand : ICommand
 {
     try
     {
         await commandsBus.SendAsync(command);
     }
     catch (NonGenericException e) when(command is Command)
     {
         await eventsBus.Publish(CommandExceptionEvent.FromCommand(command as Command, e));
     }
     catch when(command is Command)
         {
             await eventsBus.Publish(CommandExceptionEvent.FromCommand(command as Command, "Unknown error"));
         }
 }