public void TryDispatch(ICommand cmd) { try { Logger.DebugFormat("Dispatching command {0}", cmd); this.Dispatch(cmd); } catch (Exception) { Logger.WarnFormat("Failed Command {0}", cmd); } }
public async Task <TEntity> Get(TEntity entity) { GuardKeys(entity); try { TableOperation retriveOperation = TableOperation.Retrieve <TEntity>(entity.PartitionKey, entity.RowKey); TableResult result = await this.table.ExecuteAsync(retriveOperation); if (result.Result != null) { return(await Task.FromResult((TEntity)result.Result)); } return(default(TEntity)); } catch (StorageException ex) { Logger.WarnFormat("Failed to Get Entity: PartitionKey '{0}' Rowkey '{1}'", entity.PartitionKey, entity.RowKey); Logger.WarnFormat("Error: {0} with status code: {1}. Extended info: {2} ({3})", ex.RequestInformation.HttpStatusMessage, ex.RequestInformation.HttpStatusCode, ex.RequestInformation.ExtendedErrorInformation.ErrorMessage, ex.RequestInformation.ExtendedErrorInformation.ErrorCode); return(entity); } }