protected override async void HandleError(HttpResponseMessage response) { var content = await HttpHelper.AcquireContentAsync <dynamic>(response); if (!response.IsSuccessStatusCode && content.error != null) { throw new HttpRequestException((string)content.error.message); } }
protected override async void HandleError(HttpResponseMessage response) { var content = await HttpHelper.AcquireContentAsync <ResponseModel>(response); if (!String.IsNullOrEmpty(content.Error)) { throw new HttpRequestException(content.Error); } }
protected override async void HandleError(HttpResponseMessage response) { var content = await HttpHelper.AcquireContentAsync <dynamic>(response); if (!(bool)content.success && !String.IsNullOrEmpty((string)content.error)) { throw new HttpRequestException(content.Error); } }
protected override async void HandleError(HttpResponseMessage response) { var content = await HttpHelper.AcquireContentAsync <ErrorModel>(response); if (content.ErrorCode > 0) { string message = content.GetMessage(); throw new HttpRequestException(message); } }
protected override async void HandleError(HttpResponseMessage response) { if (response.IsSuccessStatusCode) { return; } var content = await HttpHelper.AcquireContentAsync <ErrorModel>(response); throw new HttpRequestException(content.Msg); }
protected async Task <TContent> CallAsync <TContent>(HttpMethod method, Uri uri, HttpContent content = null) { var request = new HttpRequestMessage(method, uri) { Content = content }; HttpResponseMessage response = await _client.SendAsync(request); HandleError(response); return(await HttpHelper.AcquireContentAsync <TContent>(response)); }
protected override async void HandleError(HttpResponseMessage response) { if (response.IsSuccessStatusCode) { return; } var content = await HttpHelper.AcquireContentAsync <ResponseModel>(response); string message = content.Msg; if (String.IsNullOrEmpty(content.Msg)) { message = "Some error occurred."; } throw new HttpRequestException(message); }