mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-24 06:50:43 +00:00
Return decisions when catching exceptions during decision making
Fixed: Manual Import not showing files that failed to process Closes #1131
This commit is contained in:
parent
aff6af1806
commit
e9248e284e
4 changed files with 43 additions and 0 deletions
|
@ -270,5 +270,23 @@ public void should_not_allow_download_if_no_episodes_found()
|
||||||
|
|
||||||
result.First().RemoteEpisode.DownloadAllowed.Should().BeFalse();
|
result.First().RemoteEpisode.DownloadAllowed.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_return_a_decision_when_exception_is_caught()
|
||||||
|
{
|
||||||
|
GivenSpecifications(_pass1);
|
||||||
|
|
||||||
|
Mocker.GetMock<IParsingService>().Setup(c => c.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<SearchCriteriaBase>()))
|
||||||
|
.Throws<TestException>();
|
||||||
|
|
||||||
|
_reports = new List<ReleaseInfo>
|
||||||
|
{
|
||||||
|
new ReleaseInfo{Title = "The.Office.S03E115.DVDRip.XviD-OSiTV"},
|
||||||
|
};
|
||||||
|
|
||||||
|
Subject.GetRssDecision(_reports).Should().HaveCount(1);
|
||||||
|
|
||||||
|
ExceptionVerification.ExpectedErrors(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -385,5 +385,24 @@ public void should_not_use_folder_quality_when_it_is_unknown()
|
||||||
|
|
||||||
result.Single().LocalEpisode.Quality.Should().Be(_quality);
|
result.Single().LocalEpisode.Quality.Should().Be(_quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_return_a_decision_when_exception_is_caught()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<IParsingService>()
|
||||||
|
.Setup(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), It.IsAny<ParsedEpisodeInfo>(), It.IsAny<bool>()))
|
||||||
|
.Throws<TestException>();
|
||||||
|
|
||||||
|
_videoFiles = new List<string>
|
||||||
|
{
|
||||||
|
"The.Office.S03E115.DVDRip.XviD-OSiTV"
|
||||||
|
};
|
||||||
|
|
||||||
|
GivenVideoFiles(_videoFiles);
|
||||||
|
|
||||||
|
Subject.GetImportDecisions(_videoFiles, _series).Should().HaveCount(1);
|
||||||
|
|
||||||
|
ExceptionVerification.ExpectedErrors(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,9 @@ private IEnumerable<DownloadDecision> GetDecisions(List<ReleaseInfo> reports, Se
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.Error(e, "Couldn't process release.");
|
_logger.Error(e, "Couldn't process release.");
|
||||||
|
|
||||||
|
var remoteEpisode = new RemoteEpisode { Release = report };
|
||||||
|
decision = new DownloadDecision(remoteEpisode, new Rejection("Unexpected error processing release"));
|
||||||
}
|
}
|
||||||
|
|
||||||
reportNumber++;
|
reportNumber++;
|
||||||
|
|
|
@ -112,6 +112,9 @@ private ImportDecision GetDecision(string file, Series series, ParsedEpisodeInfo
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.Error(e, "Couldn't import file. " + file);
|
_logger.Error(e, "Couldn't import file. " + file);
|
||||||
|
|
||||||
|
var localEpisode = new LocalEpisode { Path = file };
|
||||||
|
decision = new ImportDecision(localEpisode, new Rejection("Unexpected error processing file"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return decision;
|
return decision;
|
||||||
|
|
Loading…
Reference in a new issue