Skip to content

Commit

Permalink
Don't fault build when there's no data (#571)
Browse files Browse the repository at this point in the history
* Use OperationCanceledException

* Change exception in test
  • Loading branch information
Enkidu93 authored Dec 12, 2024
1 parent 5dd100d commit 0cfd145
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ CancellationToken cancellationToken

if (trainCount == 0 && (!sourceTagInBaseModel || !targetTagInBaseModel))
{
throw new InvalidOperationException(
throw new OperationCanceledException(
$"At least one language code in build {buildId} is unknown to the base model, and the data specified for training was empty. Build canceled."
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void RunAsync_UnknownLanguageTagsNoData()
using TestEnvironment env = new();
ParallelCorpus corpus1 = TestEnvironment.TextFileCorpus(sourceLanguage: "xxx", targetLanguage: "zzz");

Assert.ThrowsAsync<InvalidOperationException>(async () =>
Assert.ThrowsAsync<OperationCanceledException>(async () =>
{
await env.RunBuildJobAsync(corpus1, engineId: "engine2");
});
Expand Down

0 comments on commit 0cfd145

Please sign in to comment.