Skip to content

Commit

Permalink
Make "missing packages" error message more descriptive
Browse files Browse the repository at this point in the history
Currently there exists confusion due to Pursuit now showing package
sets that include a package. IOW it always looks as if every package
on Pursuit available on every "package set" from the registry. As
result, when a user receives error message from Spago that says that a
package wasn't found, unless a user already knows this situation, they
unlikely would think it's a problem on the remote side rather than
with syntax or something similar.

But on the `spago` side we can reduce confusion by showing a user
a message hinting that it is possible to enlist available packages
with `spago ls packages`.

Fixes: #1287
  • Loading branch information
Hi-Angel committed Sep 24, 2024
1 parent 6d2f796 commit 1f6818d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Spago/Command/Fetch.purs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,9 @@ getTransitiveDepsFromPackageSet packageSet deps = do
when (not (Set.isEmpty errors.cycle)) do
die $ "The following packages have circular dependencies:\n" <> foldMap printPackageError (Set.toUnfoldable errors.cycle :: Array PackageName)
when (not (Set.isEmpty errors.notInPackageSet)) do
die $ "The following packages do not exist in your package set:\n" <> foldMap printNotInPackageSetError errors.notInPackageSet
die $ "The following packages do not exist in your package set:\n"
<> foldMap printNotInPackageSetError errors.notInPackageSet
<> "To list available packages use `spago ls packages`\n"
when (not (Set.isEmpty errors.notInIndex)) do
die $ "The following packages do not exist in the package index:\n" <> foldMap printPackageError errors.notInIndex
pure packages
Expand Down
1 change: 1 addition & 0 deletions test-fixtures/missing-dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Reading Spago workspace configuration...
- bar-bar-bar
- effcet (did you mean: effect)
- foo-foo-foo
To list available packages use `spago ls packages`

0 comments on commit 1f6818d

Please sign in to comment.