mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Reverted (for now) non-200 response handling; added some extra logging.
This commit is contained in:
parent
ec973917b4
commit
3ee4ae34d5
1 changed files with 12 additions and 9 deletions
|
@ -63,13 +63,14 @@ namespace Ombi.Api
|
||||||
{
|
{
|
||||||
var message = "Error retrieving response. Check inner details for more info.";
|
var message = "Error retrieving response. Check inner details for more info.";
|
||||||
Log.Error(response.ErrorException);
|
Log.Error(response.ErrorException);
|
||||||
|
Log.Error(response.ErrorException.InnerException);
|
||||||
throw new ApiRequestException(message, response.ErrorException);
|
throw new ApiRequestException(message, response.ErrorException);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.StatusCode == HttpStatusCode.OK)
|
//if (response.StatusCode == HttpStatusCode.OK)
|
||||||
return response.Data;
|
return response.Data;
|
||||||
else
|
//else
|
||||||
throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}.");
|
// throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,14 +90,15 @@ namespace Ombi.Api
|
||||||
if (response.ErrorException != null)
|
if (response.ErrorException != null)
|
||||||
{
|
{
|
||||||
Log.Error(response.ErrorException);
|
Log.Error(response.ErrorException);
|
||||||
|
Log.Error(response.ErrorException.InnerException);
|
||||||
var message = "Error retrieving response. Check inner details for more info.";
|
var message = "Error retrieving response. Check inner details for more info.";
|
||||||
throw new ApiRequestException(message, response.ErrorException);
|
throw new ApiRequestException(message, response.ErrorException);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.StatusCode == HttpStatusCode.OK)
|
//if (response.StatusCode == HttpStatusCode.OK)
|
||||||
return DeserializeXml<T>(response.Content);
|
return DeserializeXml<T>(response.Content);
|
||||||
else
|
//else
|
||||||
throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}.");
|
// throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,14 +111,15 @@ namespace Ombi.Api
|
||||||
if (response.ErrorException != null)
|
if (response.ErrorException != null)
|
||||||
{
|
{
|
||||||
Log.Error(response.ErrorException);
|
Log.Error(response.ErrorException);
|
||||||
|
Log.Error(response.ErrorException.InnerException);
|
||||||
var message = "Error retrieving response. Check inner details for more info.";
|
var message = "Error retrieving response. Check inner details for more info.";
|
||||||
throw new ApiRequestException(message, response.ErrorException);
|
throw new ApiRequestException(message, response.ErrorException);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.StatusCode == HttpStatusCode.OK)
|
//if (response.StatusCode == HttpStatusCode.OK)
|
||||||
return JsonConvert.DeserializeObject<T>(response.Content, _settings);
|
return JsonConvert.DeserializeObject<T>(response.Content, _settings);
|
||||||
else
|
//else
|
||||||
throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}.");
|
// throw new Exception($"Got StatusCode={response.StatusCode} for {baseUri}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private T DeserializeXml<T>(string input)
|
private T DeserializeXml<T>(string input)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue