public async Task HandleAsync(CreateLancamento command) { _logger.LogInformation($"Criando o lançamento: {command.Id}"); try { await _lancService.AddAsync(command.Id, command.Data, command.ContaOrigem, command.ContaDestino, command.Valor); await _bus.PublishAsync(new LancamentoCreated(command.Id, command.UserId, command.Data, command.ContaOrigem, command.ContaDestino, command.Valor)); return; } catch (TransferException ex) { await _bus.PublishAsync(new CreateLancamentoRejected(command.Id, ex.Code, ex.Message)); _logger.LogError(ex.Message); } catch (Exception ex) { await _bus.PublishAsync(new CreateLancamentoRejected(command.Id, "error", ex.Message)); _logger.LogError(ex.Message); } }