Skip to content

Commit

Permalink
Generic try catch to fix #350
Browse files Browse the repository at this point in the history
  • Loading branch information
tidusjar committed Jun 22, 2016
1 parent af9953b commit 8b52ba2
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions PlexRequests.Services/Jobs/CouchPotatoCacher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion

using System;
using System.Linq;

using NLog;
Expand Down Expand Up @@ -86,14 +88,18 @@ public void Queued()
// we do not want to set here...
public int[] QueuedIds()
{
Log.Error("This is not an error, starting to get the CP Cached Id's");

var movies = Cache.Get<CouchPotatoMovies>(CacheKeys.CouchPotatoQueued);
Log.Error("Cached result:");
Log.Error(movies.DumpJson());
try
{
var movies = Cache.Get<CouchPotatoMovies>(CacheKeys.CouchPotatoQueued);

var items = movies?.movies?.Select(x => x.info?.tmdb_id).Cast<int>().ToArray();
return items ?? new int[] { };
var items = movies?.movies?.Select(x => x.info?.tmdb_id).Cast<int>().ToArray();
return items ?? new int[] { };
}
catch (Exception e)
{
Log.Error(e);
return new int[] {};
}
}

public void Execute(IJobExecutionContext context)
Expand Down

0 comments on commit 8b52ba2

Please sign in to comment.