mirror of
https://github.com/Radarr/Radarr
synced 2026-01-14 19:43:09 +01:00
Fixed: Catch exceptions looking up fingerprints
It's not crucial so if it fails don't take out the whole import process.
This commit is contained in:
parent
2097bfff94
commit
91ddabe5dd
2 changed files with 19 additions and 0 deletions
|
|
@ -200,5 +200,19 @@ public void should_not_throw_if_api_returns_html()
|
|||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_throw_if_api_times_out()
|
||||
{
|
||||
Mocker.GetMock<IHttpClient>().Setup(x => x.Post<LookupResponse>(It.IsAny<HttpRequest>()))
|
||||
.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> { localTrack }, 0.5);
|
||||
localTrack.AcoustIdResults.Should().BeNull();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -375,6 +375,11 @@ public void Lookup(List<Tuple<LocalTrack, AcoustId>> files, double threshold)
|
|||
_logger.Warn(e, "AcoustId API gave invalid response");
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Warn(e, "AcoustId API lookup failed");
|
||||
return;
|
||||
}
|
||||
|
||||
var response = httpResponse.Resource;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue