From 06fb6feefca14876c799e3bbfb3716b39f43331d Mon Sep 17 00:00:00 2001 From: jmsche Date: Thu, 10 Aug 2023 10:18:20 +0200 Subject: [PATCH] [AssetMapper] Improve the error message when a downloaded file is missing --- .../Component/AssetMapper/ImportMap/ImportMapManager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php b/src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php index 849273b24762..9c5b4219cf73 100644 --- a/src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php +++ b/src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php @@ -382,6 +382,10 @@ private function convertEntriesToImports(array $entries): array if (null !== $entryOptions->path) { if (!$asset = $this->assetMapper->getAsset($entryOptions->path)) { + if ($entryOptions->isDownloaded) { + throw new \InvalidArgumentException(sprintf('The "%s" downloaded asset is missing. Run "php bin/console importmap:require "%s" --download".', $entryOptions->path, $entryOptions->importName)); + } + throw new \InvalidArgumentException(sprintf('The asset "%s" mentioned in "%s" cannot be found in any asset map paths.', $entryOptions->path, basename($this->importMapConfigPath))); } $path = $asset->publicPath;