diff options
author | Vincent Ambo <mail@tazj.in> | 2023-03-03T23·16+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-03-03T23·35+0000 |
commit | 248f1c21518c7574f4e2e9e73c065a9c1f0b3e75 (patch) | |
tree | f086c1cc0bc905c8e0b44e4fd85cba986f578082 /tvix/nix-compat | |
parent | dfb8b7a2661d00a92e7732139560637e9a26867e (diff) |
chore(tvix/nix-compat): include invalid hashes in SRI hash error r/5875
Change-Id: I379b18cb07da0988f8ce4934976ae7d6566d6bb5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8210 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nix-compat')
-rw-r--r-- | tvix/nix-compat/src/nixhash.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/nix-compat/src/nixhash.rs b/tvix/nix-compat/src/nixhash.rs index 0a7b1b137531..33ffccc52e62 100644 --- a/tvix/nix-compat/src/nixhash.rs +++ b/tvix/nix-compat/src/nixhash.rs @@ -61,8 +61,8 @@ fn hash_algo_length(hash_algo: &HashAlgo) -> usize { pub enum Error { #[error("invalid hash algo: {0}")] InvalidAlgo(String), - #[error("invalid sri string")] - InvalidSRI, + #[error("invalid SRI string: {0}")] + InvalidSRI(String), #[error("invalid encoded digest length '{0}' for algo {1}")] InvalidEncodedDigestLength(usize, HashAlgo), #[error("invalid base16 encoding: {0}")] @@ -155,7 +155,7 @@ pub fn from_sri_str(s: &str) -> Result<NixHash, Error> { let idx = s.as_bytes().iter().position(|&e| e == b'-'); if idx.is_none() { - return Err(Error::InvalidSRI); + return Err(Error::InvalidSRI(s.to_string())); } let idx = idx.unwrap(); |