public async Task <IQueryResponse> ExecuteQuery(IQuery query) { var queryString = query.GetQueryString(); var serverResponse = await this.ApiClient.GetAsync(queryString); if (!serverResponse.IsSuccessStatusCode) { var failedOperation = new FailedOperationException(string.Format("Request to server failed with status code {0}", serverResponse.StatusCode)); this.logger.FatalFormat("Failed query execution for {0} with status code {1}: {2}", query.ObjectType, serverResponse.StatusCode, failedOperation); throw failedOperation; } var contentString = await serverResponse.Content.ReadAsStringAsync(); var queryResponse = new QueryResponse(contentString, query.ObjectType); this.logger.InfoFormat("Successful query execution for {0}", query.ObjectType); return(queryResponse); }
/// <summary> /// Record a failed update operation. /// </summary> /// <param name="name">User-facing name of the entity.</param> /// <param name="exception">The error that occurred.</param> public void RecordFailure(string name, FailedOperationException exception) { Operation |= LfsOperations.FailedOperation; Failures.Add(new LfsOperationFailure(exception.EntityType, (ushort)exception.GlobalFileSystemNumber, Operation, name, exception)); }
/// <summary> /// Record a failed update operation. /// </summary> /// <param name="entryType">The kind of entry whose update operation failed.</param> /// <param name="id">The LFS identifier of the entity.</param> /// <param name="name">User-facing name of the entity.</param> /// <param name="exception">The error that occurred.</param> /// <param name="targetDeviceId">The unique ID of the target device involved in the operation.</param> public void RecordFailure(LfsEntityType entryType, ushort id, string name, Exception exception, string targetDeviceId) { var error = FailedOperationException.WrapIfNeeded(exception, entryType, id, targetDeviceId); RecordFailure(name, error); }