From 86fa34628fdf678e37ecec02709b9957299ea949 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 6 Aug 2013 23:58:31 -0700 Subject: [PATCH] log exception if pubDate can't be parsed. --- NzbDrone.Core/Indexers/XElementExtensions.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core/Indexers/XElementExtensions.cs b/NzbDrone.Core/Indexers/XElementExtensions.cs index 00bc469a9..5c59cc8c9 100644 --- a/NzbDrone.Core/Indexers/XElementExtensions.cs +++ b/NzbDrone.Core/Indexers/XElementExtensions.cs @@ -2,11 +2,15 @@ using System.Collections.Generic; using System.Linq; using System.Xml.Linq; +using NLog; namespace NzbDrone.Core.Indexers { public static class XElementExtensions { + + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + public static string Title(this XElement item) { return item.TryGetValue("title", "Unknown"); @@ -14,7 +18,17 @@ namespace NzbDrone.Core.Indexers 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 Links(this XElement item)