From 8b52ba29679bcb0a602d4c057ed416c61a196cef Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 22 Jun 2016 22:21:25 +0100 Subject: [PATCH] Generic try catch to fix #350 --- .../Jobs/CouchPotatoCacher.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/PlexRequests.Services/Jobs/CouchPotatoCacher.cs b/PlexRequests.Services/Jobs/CouchPotatoCacher.cs index ee93513ab..be36d004f 100644 --- a/PlexRequests.Services/Jobs/CouchPotatoCacher.cs +++ b/PlexRequests.Services/Jobs/CouchPotatoCacher.cs @@ -24,6 +24,8 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ************************************************************************/ #endregion + +using System; using System.Linq; using NLog; @@ -86,14 +88,18 @@ namespace PlexRequests.Services.Jobs // 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(CacheKeys.CouchPotatoQueued); - Log.Error("Cached result:"); - Log.Error(movies.DumpJson()); + try + { + var movies = Cache.Get(CacheKeys.CouchPotatoQueued); - var items = movies?.movies?.Select(x => x.info?.tmdb_id).Cast().ToArray(); - return items ?? new int[] { }; + var items = movies?.movies?.Select(x => x.info?.tmdb_id).Cast().ToArray(); + return items ?? new int[] { }; + } + catch (Exception e) + { + Log.Error(e); + return new int[] {}; + } } public void Execute(IJobExecutionContext context)