8000 minor #51337 [AssetMapper] Improve the error message when a downloade… · symfony/symfony@897a054 · GitHub
[go: up one dir, main page]

Skip to content

Commit 897a054

Browse files
minor #51337 [AssetMapper] Improve the error message when a downloaded file is missing (jmsche)
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [AssetMapper] Improve the error message when a downloaded file is missing | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A When a file downloaded using the `importmap:require [packageName] --download` command is missing, the error message is this one: > The asset "vendor/`@hotwired`/stimulus.js" mentioned in "importmap.php" cannot be found in any asset map paths. This PR slightly improves the error message to explain how it can be fixed: > The "vendor/`@hotwired`/stimulus.js" downloaded asset is missing. Run "php bin/console importmap:require `@hotwired`/stimulus --download". Commits ------- 06fb6fe [AssetMapper] Improve the error message when a downloaded file is missing
2 parents 02bd9da + 06fb6fe commit 897a054

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ private function convertEntriesToImports(array $entries): array
382382

383383
if (null !== $entryOptions->path) {
384384
if (!$asset = $this->assetMapper->getAsset($entryOptions->path)) {
385+
if ($entryOptions->isDownloaded) {
386+
throw new \InvalidArgumentException(sprintf('The "%s" downloaded asset is missing. Run "php bin/console importmap:require "%s" --download".', $entryOptions->path, $entryOptions->importName));
387+
}
388+
385389
throw new \InvalidArgumentException(sprintf('The asset "%s" mentioned in "%s" cannot be found in any asset map paths.', $entryOptions->path, basename($this->importMapConfigPath)));
386390
}
387391
$path = $asset->publicPath;

0 commit comments

Comments
 (0)
0