mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Stop the Cachers from bombing out when the response from the 3rd party api returns an exception or invalid response. #171
This commit is contained in:
parent
54ab4854e6
commit
076a75b82f
12 changed files with 138 additions and 29 deletions
|
@ -41,6 +41,8 @@ using PlexRequests.Helpers;
|
|||
using RestSharp;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PlexRequests.Helpers.Exceptions;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class SickrageApi : ISickRageApi
|
||||
|
@ -218,7 +220,20 @@ namespace PlexRequests.Api
|
|||
};
|
||||
request.AddUrlSegment("apiKey", apiKey);
|
||||
|
||||
return await Task.Run(() => Api.Execute<SickrageShows>(request, baseUrl)).ConfigureAwait(false);
|
||||
return await Task.Run(
|
||||
() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return Api.Execute<SickrageShows>(request, baseUrl);
|
||||
}
|
||||
catch (ApiRequestException)
|
||||
{
|
||||
Log.Error("There has been a API exception when Getting the Sickrage shows");
|
||||
return null;
|
||||
}
|
||||
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue