mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Some styling
This commit is contained in:
parent
725678779a
commit
37aa6b938d
9 changed files with 102 additions and 37 deletions
|
@ -39,7 +39,7 @@ namespace PlexRequests.Api
|
|||
{
|
||||
public class ApiRequest : IApiRequest
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// An API request handler
|
||||
/// </summary>
|
||||
|
@ -54,7 +54,7 @@ namespace PlexRequests.Api
|
|||
var response = client.Execute<T>(request);
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
{
|
||||
var message = "Error retrieving response. Check inner details for more info.";
|
||||
throw new ApplicationException(message, response.ErrorException);
|
||||
}
|
||||
|
@ -75,7 +75,8 @@ namespace PlexRequests.Api
|
|||
throw new ApplicationException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
return Deserialize<T>(response.Content);
|
||||
var result = Deserialize<T>(response.Content);
|
||||
return result;
|
||||
}
|
||||
|
||||
public T Deserialize<T>(string input)
|
||||
|
@ -83,8 +84,15 @@ namespace PlexRequests.Api
|
|||
{
|
||||
var ser = new XmlSerializer(typeof(T));
|
||||
|
||||
using (var sr = new StringReader(input))
|
||||
return (T)ser.Deserialize(sr);
|
||||
try
|
||||
{
|
||||
using (var sr = new StringReader(input))
|
||||
return (T)ser.Deserialize(sr);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue