From e7062e6a54d3c67ff834663ccdda3201b9927e62 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Tue, 24 Sep 2024 01:00:44 +0300 Subject: [PATCH] Make "missing packages" error message more descriptive Currently there exist 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: https://github.com/purescript/spago/issues/1287 --- src/Spago/Command/Fetch.purs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Spago/Command/Fetch.purs b/src/Spago/Command/Fetch.purs index 29c2f3bb0..b63919608 100644 --- a/src/Spago/Command/Fetch.purs +++ b/src/Spago/Command/Fetch.purs @@ -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