Rss feed paring will check for errors and give a better error if found.

pull/2/head
Mark McDowall 12 years ago
parent 7a80c81ffb
commit 9048da1dd5

@ -2,6 +2,7 @@
//https://connect.microsoft.com/VisualStudio/feedback/details/325421/syndicationfeed-load-fails-to-parse-datetime-against-a-real-world-feeds-ie7-can-read
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
@ -33,6 +34,8 @@ namespace NzbDrone.Core.Providers.Indexer
_isRss2DateTime = rss20DateTimeHints.Contains(localname);
_isAtomDateTime = atom10DateTimeHints.Contains(localname);
CheckForError();
return base.IsStartElement(localname, ns);
}
@ -70,5 +73,30 @@ namespace NzbDrone.Core.Providers.Indexer
return dateVal;
}
internal void CheckForError()
{
if (this.MoveToContent() == XmlNodeType.Element)
{
if (this.Name != "error")
return;
var message = "Error: ";
if (this.HasAttributes)
{
var attributes = new Dictionary<string, string>();
while (this.MoveToNextAttribute())
{
message += String.Format(" [{0}:{1}]", this.Name, this.Value);
}
}
logger.Error("Error in RSS feed: {0}", message);
throw new Exception(message);
}
}
}
}

Loading…
Cancel
Save