private void Handle(WebServiceType type, ServiceAuthenticationException ex, string additionalErrorInfo) { _servicesStatus.SetStatus(type, false, ex.Message); _errorHandler.Error(new Exception(additionalErrorInfo, ex), $"Authentication error for {type} service:" + Environment.NewLine + Environment.NewLine + ex.Message); }
private async Task HandleResponse(HttpResponseMessage response) { //response.EnsureSuccessStatusCode(); if (!response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); if (response.StatusCode == HttpStatusCode.Forbidden || response.StatusCode == HttpStatusCode.Unauthorized) { var serviceAuthException = new ServiceAuthenticationException(content); throw serviceAuthException; } var httpRequestException = new HttpRequestExceptionEx(response.StatusCode, content); //Microsoft.AppCenter.Crashes.Crashes.TrackError(httpRequestException); throw httpRequestException; } }