From 3ee4ae34d572b20a9a926c5a8b6d6ba86115a565 Mon Sep 17 00:00:00 2001 From: smcpeck Date: Mon, 27 Feb 2017 23:46:06 -0600 Subject: [PATCH] Reverted (for now) non-200 response handling; added some extra logging. --- Ombi.Api/ApiRequest.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Ombi.Api/ApiRequest.cs b/Ombi.Api/ApiRequest.cs index 9566d2be0..3abe469f2 100644 --- a/Ombi.Api/ApiRequest.cs +++ b/Ombi.Api/ApiRequest.cs @@ -63,13 +63,14 @@ namespace Ombi.Api { var message = "Error retrieving response. Check inner details for more info."; Log.Error(response.ErrorException); + Log.Error(response.ErrorException.InnerException); throw new ApiRequestException(message, response.ErrorException); } - if (response.StatusCode == HttpStatusCode.OK) + //if (response.StatusCode == HttpStatusCode.OK) return response.Data; - else - throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}."); + //else + // throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}."); } @@ -89,14 +90,15 @@ namespace Ombi.Api if (response.ErrorException != null) { Log.Error(response.ErrorException); + Log.Error(response.ErrorException.InnerException); var message = "Error retrieving response. Check inner details for more info."; throw new ApiRequestException(message, response.ErrorException); } - if (response.StatusCode == HttpStatusCode.OK) + //if (response.StatusCode == HttpStatusCode.OK) return DeserializeXml(response.Content); - else - throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}."); + //else + // throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}."); } @@ -109,14 +111,15 @@ namespace Ombi.Api if (response.ErrorException != null) { Log.Error(response.ErrorException); + Log.Error(response.ErrorException.InnerException); var message = "Error retrieving response. Check inner details for more info."; throw new ApiRequestException(message, response.ErrorException); } - if (response.StatusCode == HttpStatusCode.OK) + //if (response.StatusCode == HttpStatusCode.OK) return JsonConvert.DeserializeObject(response.Content, _settings); - else - throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}."); + //else + // throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}."); } private T DeserializeXml(string input)