8000 Throw exception before download query if entry is not valid · symfony/symfony@47e334d · GitHub
[go: up one dir, main page]

Skip to content

Commit 47e334d

Browse files
Throw exception before download query if entry is not valid
1 parent 8adabc1 commit 47e334d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function downloadPackages(array $importMapEntries, callable $progressCall
162162
foreach ($importMapEntries as $package => $entry) {
163163
$pattern = ImportMapType::CSS === $entry->type ? $this->distUrlCssPattern : $this->distUrlPattern;
164164
if (null === $entry->packageName || null === $entry->version || null === $entry->filePath) {
165-
throw new RuntimeException(sprintf('The package %s cannot be downloaded. "packageName", "version" or "filePath" must be defined.', $entry->importName));
165+
throw new RuntimeException(sprintf('The package "%s" cannot be downloaded. "packageName", "version" and "filePath" must be defined.', $entry->importName));
166166
}
167167
$url = sprintf($pattern, $entry->packageName, $entry->version, $entry->filePath);
168168

src/Symfony/Component/AssetMapper/Tests/ImportMap/Resolver/JsDelivrEsmResolverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public function testDownloadPackages(array $importMapEntries, array $expectedReq
293293
public static function provideDownloadPackagesTests()
294294
{
295295
yield 'single package' => [
296-
['lodash' => new ImportMapEntry('lodash', version: '1.2.3', packageName: 'lodash')],
296+
['lodash' => new ImportMapEntry('lodash', version: '1.2.3', packageName: 'lodash', filePath: '')],
297297
[
298298
[
299299
'url' => '/lodash@1.2.3/+esm',
@@ -333,7 +333,7 @@ public static function provideDownloadPackagesTests()
333333

334334
yield 'multiple files' => [
335335
[
336-
'lodash' => new ImportMapEntry('lodash', version: '1.2.3', packageName: 'lodash'),
336+
'lodash' => new ImportMapEntry('lodash', version: '1.2.3', packageName: 'lodash', filePath: ''),
337337
'chart.js/auto' => new ImportMapEntry('chart.js/auto', version: '4.5.6', packageName: 'chart.js', filePath: '/auto'),
338338
'bootstrap/dist/bootstrap.css' => new ImportMapEntry('bootstrap/dist/bootstrap.css', version: '5.0.6', type: ImportMapType::CSS, packageName: 'bootstrap', filePath: '/dist/bootstrap.css'),
339339
],

0 commit comments

Comments
 (0)
0