diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php index b3354dc..b4afdb5 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php @@ -124,7 +124,7 @@ public function buildByExtension($extension) { if ($type == 'css' && !empty($library[$type])) { foreach ($library[$type] as $category => $files) { if (empty($files)) { - throw new InvalidCssDefinitionException(sprintf("You have to key the css files in the %s.library.yml file by category ('%s' seems to be a file name, allowed categories are Base, Layout, Component, State, Theme)", $extension, $category)); + throw new InvalidCssDefinitionException(sprintf("Every CSS asset must be nested under a SMACSS category in the %s.library.yml file ('%s' seems to be a file name, allowed categories are Base, Layout, Component, State, Theme)", $extension, $category)); } foreach ($files as $source => $options) { if (!isset($options['weight'])) { @@ -136,7 +136,7 @@ public function buildByExtension($extension) { $options['weight'] += constant('CSS_' . strtoupper($category)); } else { - throw new InvalidCssDefinitionException(sprintf("You have used an invalid category %s in %s.libraries.yml. Allowed categories are Base, Layout, Component, State, Theme)", $category, $extension)); + throw new InvalidCssDefinitionException(sprintf("You must use a valid SMACSS category to nest a CSS asset. %s is invalid in %s.libraries.yml. Allowed categories are Base, Layout, Component, State, Theme)", $category, $extension)); } $library[$type][$source] = $options; } diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php index c73cc35..6c92672 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php @@ -182,7 +182,8 @@ public function testBuildByExtensionWithMissingInformation() { * Tests that an exception is thrown when no CSS category is specified. * * @expectedException \Drupal\Core\Asset\Exception\InvalidCssDefinitionException - * @expectedExceptionMessage Every CSS asset must be nested under a SMACSS category, i.e. either theme, or base. See for details. + * @expectedExceptionMessage Every CSS asset must be nested under a SMACSS category + * @expectedExceptionMessage css_missing_category * * @covers ::buildByExtension */ @@ -203,7 +204,8 @@ public function testBuildByExtensionWithMissingCSSCategory() { * Tests that an exception is thrown when no an invalid CSS category is used. * * @expectedException \Drupal\Core\Asset\Exception\InvalidCssDefinitionException - * @expectedExceptionMessage You must use a valid SMACSS category to nest a CSS asset, i.e. either theme, or base. See for details. + * @expectedExceptionMessage You must use a valid SMACSS category to nest a CSS asset + * @expectedExceptionMessage css_invalid_category * * @covers ::buildByExtension */