diff options
author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-10-16 15:49:53 +0200 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-10-16 15:50:10 +0200 |
commit | 7247ec07ba5d78f7ce93b89461a1503a9a1b021f (patch) | |
tree | 27d5f28857d2f2a6e7f7d5a2452dfb87d8eefaaf /lib/fileset | |
parent | 34459dd142b6411043aed1ab037fb093308ebfa2 (diff) | |
download | nixpkgs-7247ec07ba5d78f7ce93b89461a1503a9a1b021f.tar nixpkgs-7247ec07ba5d78f7ce93b89461a1503a9a1b021f.tar.gz nixpkgs-7247ec07ba5d78f7ce93b89461a1503a9a1b021f.tar.bz2 nixpkgs-7247ec07ba5d78f7ce93b89461a1503a9a1b021f.tar.lz nixpkgs-7247ec07ba5d78f7ce93b89461a1503a9a1b021f.tar.xz nixpkgs-7247ec07ba5d78f7ce93b89461a1503a9a1b021f.tar.zst nixpkgs-7247ec07ba5d78f7ce93b89461a1503a9a1b021f.zip |
lib.fileset: Improved error for unsupported coercion values
Diffstat (limited to 'lib/fileset')
-rw-r--r-- | lib/fileset/internal.nix | 4 | ||||
-rwxr-xr-x | lib/fileset/tests.sh | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/fileset/internal.nix b/lib/fileset/internal.nix index 546b93f158a..9892172955c 100644 --- a/lib/fileset/internal.nix +++ b/lib/fileset/internal.nix @@ -172,11 +172,11 @@ rec { else if ! isPath value then if isStringLike value then throw '' - ${context} ("${toString value}") is a string-like value, but it should be a path instead. + ${context} ("${toString value}") is a string-like value, but it should be a file set or a path instead. Paths represented as strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead.'' else throw '' - ${context} is of type ${typeOf value}, but it should be a path instead.'' + ${context} is of type ${typeOf value}, but it should be a file set or a path instead.'' else if ! pathExists value then throw '' ${context} (${toString value}) does not exist.'' diff --git a/lib/fileset/tests.sh b/lib/fileset/tests.sh index 7a104654983..529f23ae887 100755 --- a/lib/fileset/tests.sh +++ b/lib/fileset/tests.sh @@ -355,8 +355,8 @@ expectFailure 'toSource { root = ./a; fileset = ./.; }' 'lib.fileset.toSource: ` rm -rf * # Path coercion only works for paths -expectFailure 'toSource { root = ./.; fileset = 10; }' 'lib.fileset.toSource: `fileset` is of type int, but it should be a path instead.' -expectFailure 'toSource { root = ./.; fileset = "/some/path"; }' 'lib.fileset.toSource: `fileset` \("/some/path"\) is a string-like value, but it should be a path instead. +expectFailure 'toSource { root = ./.; fileset = 10; }' 'lib.fileset.toSource: `fileset` is of type int, but it should be a file set or a path instead.' +expectFailure 'toSource { root = ./.; fileset = "/some/path"; }' 'lib.fileset.toSource: `fileset` \("/some/path"\) is a string-like value, but it should be a file set or a path instead. \s*Paths represented as strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead.' # Path coercion errors for non-existent paths |