diff options
author | Qyriad <qyriad@qyriad.me> | 2024-05-21 05:29:52 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-05-21 05:55:13 -0600 |
commit | 20981461d4a2a62c68f4bc7c4258473f7cd7d8e1 (patch) | |
tree | 0067ccf7f5ff99ae91cdb206eb2326cb9ab63caa /src | |
parent | 3de77e6dbd88e84fd555e25f31a57959f8c28dd5 (diff) |
print type and value in "flake attr is not a derivation" errors
This turns errors like:
error: flake output attribute 'hydraJobs' is not a derivation or path
into errors like:
error: expected flake output attribute 'hydraJobs' to be a derivation or
path but found a set: { binaryTarball = «thunk»; build = «thunk»; etc> }
This change affects all InstallableFlake commands.
Change-Id: I899757af418b6f98201006ec6ee13a448c07077c
Diffstat (limited to 'src')
-rw-r--r-- | src/libcmd/installable-flake.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libcmd/installable-flake.cc b/src/libcmd/installable-flake.cc index 615f70945..46bdd411b 100644 --- a/src/libcmd/installable-flake.cc +++ b/src/libcmd/installable-flake.cc @@ -105,9 +105,14 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths() fmt("while evaluating the flake output attribute '%s'", attrPath))) { return { *derivedPathWithInfo }; + } else { + throw Error( + "expected flake output attribute '%s' to be a derivation or path but found %s: %s", + attrPath, + showType(v), + ValuePrinter(*this->state, v, errorPrintOptions) + ); } - else - throw Error("flake output attribute '%s' is not a derivation or path", attrPath); } auto drvPath = attr->forceDerivation(); |