Now checking for errors before parsing newznab feeds

This commit is contained in:
Mark McDowall
2013-09-26 21:41:08 -07:00
parent ca429cf5de
commit 9fa4cedb71
11 changed files with 107 additions and 16 deletions
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Net;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
using System.Linq;
@@ -30,7 +31,6 @@ namespace NzbDrone.Core.Indexers
_logger = logger;
}
public virtual IList<ReleaseInfo> FetchRss(IIndexer indexer)
{
_logger.Debug("Fetching feeds from " + indexer.Name);
@@ -53,7 +53,6 @@ namespace NzbDrone.Core.Indexers
return result;
}
private IList<ReleaseInfo> Fetch(IIndexer indexer, SeasonSearchCriteria searchCriteria, int offset)
{
_logger.Debug("Searching for {0} offset: {1}", searchCriteria, offset);
@@ -117,15 +116,21 @@ namespace NzbDrone.Core.Indexers
}
catch (WebException webException)
{
if (webException.Message.Contains("502") || webException.Message.Contains("503") || webException.Message.Contains("timed out"))
if (webException.Message.Contains("502") || webException.Message.Contains("503") ||
webException.Message.Contains("timed out"))
{
_logger.Warn("{0} server is currently unavailable. {1} {2}", indexer.Name, url, webException.Message);
_logger.Warn("{0} server is currently unavailable. {1} {2}", indexer.Name, url,
webException.Message);
}
else
{
_logger.Warn("{0} {1} {2}", indexer.Name, url, webException.Message);
}
}
catch (ApiKeyException)
{
_logger.Warn("Invalid API Key for {0} {1}", indexer.Name, url);
}
catch (Exception feedEx)
{
feedEx.Data.Add("FeedUrl", url);