8000 minor #52521 [AssetMapper] Improving exception if a vendor asset's pa… · jschaedl/symfony@18d866c · GitHub
[go: up one dir, main page]

Skip to content

Commit 18d866c

Browse files
minor symfony#52521 [AssetMapper] Improving exception if a vendor asset's path is not mapped (weaverryan)
This PR was merged into the 6.4 branch. Discussion ---------- [AssetMapper] Improving exception if a vendor asset's path is not mapped | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix symfony#52513 | License | MIT <img width="931" alt="Screenshot 2023-11-09 at 1 33 49 PM" src="https://github.com/symfony/symfony/assets/121003/71259583-97fa-40b6-9aab-ead80cf2d316"> It's a bit long - but this should be a RARE error, when users are messing around with asset mapper paths. So giving them more info is better. /cc `@evertharmeling` :) Commits ------- 4d66462 [AssetMapper] Improving exception if a vendor asset's path is not mapped
2 parents a647f55 + 4d66462 commit 18d866c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ private function findEagerImports(MappedAsset $asset): array
241241
private function createMissingImportMapAssetException(ImportMapEntry $entry): \InvalidArgumentException
242242
{
243243
if ($entry->isRemotePackage()) {
244-
throw new LogicException(sprintf('The "%s" vendor asset is missing. Try running the "importmap:install" command.', $entry->importName));
244+
if (!is_file($entry->path)) {
245+
throw new LogicException(sprintf('The "%s" vendor asset is missing. Try running the "importmap:install" command.', $entry->importName));
246+
}
247+
248+
throw new LogicException(sprintf('The "%s" vendor file exists locally (%s), but cannot be found in any asset map paths. Be sure the assets vendor directory is an asset mapper path.', $entry->importName, $entry->path));
245249
}
246250

247251
throw new LogicException(sprintf('The asset "%s" cannot be found in any asset map paths.', $entry->path));

0 commit comments

Comments
 (0)
0