feat(tvix/eval): introduce ErrorKind::InvalidHash
The nixhash errors were wrapped in a generic TvixError. Now it has its own TvixError with unique error code. The nixhash error is passed along as a string. The errors looked like: error[E997]: invalid encoded digest length '51' for algo sha256 Now they look like: error[E041]: Invalid hash: invalid encoded digest length '51' for algo sha256 Change-Id: I5c420815538ba4c6567c95f5d44d60c4d48f43fd Reviewed-on: https://cl.tvl.fyi/c/depot/+/12718 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
aecf0641a4
commit
05cb6e9e35
2 changed files with 6 additions and 2 deletions
|
@ -73,8 +73,7 @@ async fn extract_fetch_args(
|
|||
let sha256 = match sha256_str {
|
||||
Some(sha256_str) => {
|
||||
let nixhash = nixhash::from_str(&sha256_str, Some("sha256"))
|
||||
// TODO: DerivationError::InvalidOutputHash should be moved to ErrorKind::InvalidHash and used here instead
|
||||
.map_err(|e| ErrorKind::TvixError(Rc::new(e)))?;
|
||||
.map_err(|e| ErrorKind::InvalidHash(e.to_string()))?;
|
||||
|
||||
Some(nixhash.digest_as_bytes().try_into().expect("is sha256"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue