diff --git a/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs b/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs index 2d2e06f7..f85d35c1 100644 --- a/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs +++ b/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs @@ -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." ); } diff --git a/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs b/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs index 470817cc..f318524f 100644 --- a/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs +++ b/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs @@ -238,7 +238,7 @@ public void RunAsync_UnknownLanguageTagsNoData() using TestEnvironment env = new(); ParallelCorpus corpus1 = TestEnvironment.TextFileCorpus(sourceLanguage: "xxx", targetLanguage: "zzz"); - Assert.ThrowsAsync(async () => + Assert.ThrowsAsync(async () => { await env.RunBuildJobAsync(corpus1, engineId: "engine2"); });