diff --git a/src/NzbDrone.Core.Test/ParserTests/FingerprintingServiceFixture.cs b/src/NzbDrone.Core.Test/ParserTests/FingerprintingServiceFixture.cs index e004d6a1a..002f1016d 100644 --- a/src/NzbDrone.Core.Test/ParserTests/FingerprintingServiceFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/FingerprintingServiceFixture.cs @@ -200,5 +200,19 @@ FINGERPRINT=AQAHJlMURlEURcgP6cwRD43Y4Ptw9FowncWPWkf6GB9-JYdP9OgJHw8u4Apw4SsOHMdx ExceptionVerification.ExpectedWarns(1); } + + [Test] + public void should_not_throw_if_api_times_out() + { + Mocker.GetMock().Setup(x => x.Post(It.IsAny())) + .Throws(new System.Net.WebException("The operation has timed out.")); + + var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Media", "nin.mp3"); + var localTrack = new LocalTrack { Path = path }; + Subject.Lookup(new List { localTrack }, 0.5); + localTrack.AcoustIdResults.Should().BeNull(); + + ExceptionVerification.ExpectedWarns(1); + } } } diff --git a/src/NzbDrone.Core/Parser/FingerprintingService.cs b/src/NzbDrone.Core/Parser/FingerprintingService.cs index 42b532a46..596583488 100644 --- a/src/NzbDrone.Core/Parser/FingerprintingService.cs +++ b/src/NzbDrone.Core/Parser/FingerprintingService.cs @@ -375,6 +375,11 @@ namespace NzbDrone.Core.Parser _logger.Warn(e, "AcoustId API gave invalid response"); return; } + catch (Exception e) + { + _logger.Warn(e, "AcoustId API lookup failed"); + return; + } var response = httpResponse.Resource;