public async Task HandleAsync(CreateConnection command) { _logger.LogInformation("Creating Connection: ", command.Observations); try { await _pointService.AddConnectionAsync(command.Id, command.Cost, command.Destination, command.Observations); await _busClient.PublishAsync(new ConnectionCreated(command.Id, command.Cost, command.Destination, command.Observations)); return; } catch (DeliveryServiceException ex) { await _busClient.PublishAsync(new ConnectionCreatedRejected(command.Id, ex.Message, ex.Code)); _logger.LogError(ex.Message); } catch (Exception ex) { await _busClient.PublishAsync(new ConnectionCreatedRejected(command.Id, ex.Message, "error")); _logger.LogError(ex.Message); } }