mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 23:42:33 +01:00
Rss feed paring will check for errors and give a better error if found.
This commit is contained in:
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
|
//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;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -33,6 +34,8 @@ namespace NzbDrone.Core.Providers.Indexer
|
|||||||
_isRss2DateTime = rss20DateTimeHints.Contains(localname);
|
_isRss2DateTime = rss20DateTimeHints.Contains(localname);
|
||||||
_isAtomDateTime = atom10DateTimeHints.Contains(localname);
|
_isAtomDateTime = atom10DateTimeHints.Contains(localname);
|
||||||
|
|
||||||
|
CheckForError();
|
||||||
|
|
||||||
return base.IsStartElement(localname, ns);
|
return base.IsStartElement(localname, ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,5 +73,30 @@ namespace NzbDrone.Core.Providers.Indexer
|
|||||||
|
|
||||||
return dateVal;
|
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…
Reference in New Issue
Block a user