feat(tvix/glue): use InvalidHash for builtins.path
Previously such errors showed up as: error[E006]: expected value of type 'sha256', but found a 'not a sha256' Now they show up as: error[E041]: Invalid hash: invalid encoded digest length '31' for algo sha256 This is consistent with the errors of `builtins.fetchurl`. Change-Id: Id11b26fc7951778640cc4e41b3bf23203eaf07df Reviewed-on: https://cl.tvl.fyi/c/depot/+/12719 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
parent
05cb6e9e35
commit
37835634e8
1 changed files with 1 additions and 10 deletions
|
@ -353,16 +353,7 @@ mod import_builtins {
|
|||
match nix_compat::nixhash::from_str(expected.to_str()?, Some("sha256")) {
|
||||
Ok(NixHash::Sha256(digest)) => Ok(digest),
|
||||
Ok(_) => unreachable!(),
|
||||
Err(_e) => {
|
||||
// TODO: a better error would be nice, we use
|
||||
// DerivationError::InvalidOutputHash usually for derivation construction.
|
||||
// This is not a derivation construction, should we move it outside and
|
||||
// generalize?
|
||||
Err(ErrorKind::TypeError {
|
||||
expected: "sha256",
|
||||
actual: "not a sha256",
|
||||
})
|
||||
}
|
||||
Err(e) => Err(ErrorKind::InvalidHash(e.to_string())),
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue