public async void LogOriginalRideEta(Guid orderId, long?originalEta) { try { var request = new LogOriginalEtaRequest { OrderId = orderId, OriginalEta = originalEta }; //This needs to be awaited to catch exceptions and must be the last task to be awaited before the end of this try catch block. await UseServiceClientAsync <MetricsServiceClient>( client => client.LogOriginalRideEta(request), exception => { // rethrow the exception, we don't need to use the HandleError process. throw exception; }); } catch (Exception ex) { // If logging fails, run app anyway and log exception Logger.LogError(ex); } }
public object Post(LogOriginalEtaRequest request) { var order = _orderDao.FindOrderStatusById(request.OrderId); if (order != null && !order.OriginalEta.HasValue && request.OriginalEta.HasValue) { _commandBus.Send(new LogOriginalEta { OrderId = request.OrderId, OriginalEta = request.OriginalEta.Value }); } return(new HttpResult(HttpStatusCode.OK)); }
public Task LogOriginalRideEta(LogOriginalEtaRequest request) { return(Client.PostAsync <string>("/order/logeta", request, logger: Logger)); }