mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-26 01:37:07 +00:00
log exception if pubDate can't be parsed.
This commit is contained in:
parent
3f8f0c2130
commit
86fa34628f
1 changed files with 15 additions and 1 deletions
|
@ -2,11 +2,15 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using NLog;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers
|
namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
public static class XElementExtensions
|
public static class XElementExtensions
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public static string Title(this XElement item)
|
public static string Title(this XElement item)
|
||||||
{
|
{
|
||||||
return item.TryGetValue("title", "Unknown");
|
return item.TryGetValue("title", "Unknown");
|
||||||
|
@ -14,7 +18,17 @@ namespace NzbDrone.Core.Indexers
|
||||||
|
|
||||||
public static DateTime PublishDate(this XElement item)
|
public static DateTime PublishDate(this XElement item)
|
||||||
{
|
{
|
||||||
return DateTime.Parse(item.TryGetValue("pubDate"));
|
string dateString = item.TryGetValue("pubDate");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return DateTime.Parse(dateString);
|
||||||
|
}
|
||||||
|
catch (FormatException e)
|
||||||
|
{
|
||||||
|
Logger.TraceException("Unable to parse " + dateString, e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> Links(this XElement item)
|
public static List<String> Links(this XElement item)
|
||||||
|
|
Loading…
Reference in a new issue