From 0503d7eea63d32a6119e6c15c8d5962b83dce328 Mon Sep 17 00:00:00 2001 From: kayone Date: Sat, 30 Nov 2013 16:03:15 -0800 Subject: [PATCH] ignore known xem errors. --- src/NzbDrone.Core.Test/Providers/XemProxyFixture.cs | 8 ++++---- src/NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core.Test/Providers/XemProxyFixture.cs b/src/NzbDrone.Core.Test/Providers/XemProxyFixture.cs index c1bbee68d..293e804d8 100644 --- a/src/NzbDrone.Core.Test/Providers/XemProxyFixture.cs +++ b/src/NzbDrone.Core.Test/Providers/XemProxyFixture.cs @@ -39,13 +39,13 @@ namespace NzbDrone.Core.Test.Providers } } - [Test] - public void should_return_empty_when_series_is_not_found() + [TestCase(12345, Description = "invalid id")] + [TestCase(267440, Description = "no single connection")] + public void should_return_empty_when_known_error(int id) { - Subject.GetSceneTvdbMappings(12345).Should().BeEmpty(); + Subject.GetSceneTvdbMappings(id).Should().BeEmpty(); } - [TestCase(82807)] public void should_get_mapping(int seriesId) { diff --git a/src/NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs b/src/NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs index 4f7eeba63..f3c381b7b 100644 --- a/src/NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs +++ b/src/NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs @@ -20,6 +20,9 @@ namespace NzbDrone.Core.DataAugmentation.Xem private const string XEM_BASE_URL = "http://thexem.de/map/"; + private static readonly string[] IgnoredErrors = { "no single connection", "no show with the tvdb_id" }; + + public XemProxy(Logger logger) { _logger = logger; @@ -67,10 +70,12 @@ namespace NzbDrone.Core.DataAugmentation.Xem private static void CheckForFailureResult(XemResult response) { if (response.Result.Equals("failure", StringComparison.InvariantCultureIgnoreCase) && - !response.Message.Contains("no show with the tvdb_id")) + !IgnoredErrors.Any(knowError => response.Message.Contains(knowError))) { throw new Exception("Error response received from Xem: " + response.Message); } } + + } }