spago icon indicating copy to clipboard operation
spago copied to clipboard

Display all problems with spago.dhall at once

Open flip111 opened this issue 4 years ago • 8 comments

» spago bump-version --no-dry-run v1.0.0
[info] Generating a new Bower config using the package set versions..
spago: Error: Error while reading spago.dhall:

Explanation: a record is missing a required key.

The key missing is:

↳ license

The keys in the record are:

↳ dependencies, name, packages, sources


» spago bump-version --no-dry-run v1.0.0
[info] Generating a new Bower config using the package set versions..
spago: Error: Error while reading spago.dhall:

Explanation: a record is missing a required key.

The key missing is:

↳ repository

The keys in the record are:

↳ dependencies, license, name, packages, sources

Could both errors be listed at the same time?

flip111 avatar Apr 05 '20 15:04 flip111

These errors are coming from Dhall interpreter.

klntsky avatar Apr 05 '20 15:04 klntsky

From looking at the issues tagged "error messages" on the dhall-haskell repo I can't see one which covers the issue you've raised: https://github.com/dhall-lang/dhall-haskell/issues?page=2&q=is%3Aissue+label%3A%22error+messages%22. It may be worth reporting this there.

hdgarrood avatar Apr 05 '20 15:04 hdgarrood

These errors are coming from Dhall interpreter.

Guys from dhall, say errors are not produced in dhall. https://github.com/dhall-lang/dhall-haskell/issues/1010#issuecomment-609438538

flip111 avatar Apr 05 '20 15:04 flip111

Oops, that's right, @flip111. Thanks for correction.

klntsky avatar Apr 05 '20 16:04 klntsky

Yeah this is due to the smarts of how we parse the Config for publishing - right now we just raise an error the first time we encounter it, but we should collect them before failing instead

f-f avatar Apr 05 '20 16:04 f-f

Is there a good way of asking spago to report the original error from Dhall rather than constructing its own error message? I'm coming across a sort-of-related problem where if a record key has the wrong type, the error from spago describes the key as "missing", e.g. if your spago.dhall says

{ name = 0
, dependencies = 0
, packages = 0
, sources = 0
}

then you get

$ spago build
[error] Error: Error while reading spago.dhall:

Explanation: a record is missing a required key.

The key missing is:

↳ name

The keys in the record are:

↳ dependencies, name, packages, sources

hdgarrood avatar Apr 11 '20 20:04 hdgarrood

@hdgarrood the reason why error messages are so far away from Dhall ones is that our config is a bit of a special Dhall file (for historical reasons, and backwards compatibility, etc). We'd really need some tidying up in the way we handle/manage/parse the config in the Spago.Config module. Related: #594

f-f avatar Apr 12 '20 11:04 f-f

It's unclear to me from the linked dhall-haskell issue if that library actually supports collecting errors at this stage. I'm not familiar enough with Haskell to know - it's MonadThrow, so is it likely?

samhh avatar Jul 05 '21 17:07 samhh

The new Spago does not use Dhall anymore.

f-f avatar Sep 16 '23 10:09 f-f