diff --git a/src/Serval/src/Serval.DataFiles/Controllers/CorporaController.cs b/src/Serval/src/Serval.DataFiles/Controllers/CorporaController.cs index 7c9028a0..29a72170 100644 --- a/src/Serval/src/Serval.DataFiles/Controllers/CorporaController.cs +++ b/src/Serval/src/Serval.DataFiles/Controllers/CorporaController.cs @@ -81,6 +81,8 @@ public async Task> CreateAsync( CancellationToken cancellationToken ) { + if (corpusConfig.Language.Length == 0) + return BadRequest("Corpus must have a language."); Corpus corpus = await MapAsync(corpusConfig, idGenerator.GenerateId(), cancellationToken); await _corpusService.CreateAsync(corpus, cancellationToken); CorpusDto dto = Map(corpus); @@ -157,8 +159,6 @@ private async Task AuthorizeAsync(string id, CancellationToken cancellationToken private async Task MapAsync(CorpusConfigDto corpusConfig, string id, CancellationToken cancellationToken) { - if (corpusConfig.Language.Length == 0) - throw new InvalidOperationException("Corpus must have a language."); return new Corpus { Id = id,