diff --git a/src/lib/Repository/LanguageService.php b/src/lib/Repository/LanguageService.php index 2d6857e5e8..8e47d8ab2b 100644 --- a/src/lib/Repository/LanguageService.php +++ b/src/lib/Repository/LanguageService.php @@ -90,7 +90,10 @@ public function createLanguage(LanguageCreateStruct $languageCreateStruct): Lang try { if ($this->loadLanguage($languageCreateStruct->languageCode) !== null) { - throw new InvalidArgumentException('languageCreateStruct', 'language with the specified language code already exists'); + throw new InvalidArgumentException( + 'languageCreateStruct', + sprintf('language with the "%s" language code already exists', $languageCreateStruct->languageCode) + ); } } catch (APINotFoundException $e) { // Do nothing diff --git a/tests/integration/Core/Repository/LanguageServiceTest.php b/tests/integration/Core/Repository/LanguageServiceTest.php index 5aec2ac61d..a0698f4682 100644 --- a/tests/integration/Core/Repository/LanguageServiceTest.php +++ b/tests/integration/Core/Repository/LanguageServiceTest.php @@ -128,7 +128,7 @@ public function testCreateLanguageSetsExpectedProperties($language) public function testCreateLanguageThrowsInvalidArgumentException() { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Argument \'languageCreateStruct\' is invalid: language with the specified language code already exists'); + $this->expectExceptionMessage('Argument \'languageCreateStruct\' is invalid: language with the "nor-NO" language code already exists'); $repository = $this->getRepository();