From 248f1c21518c7574f4e2e9e73c065a9c1f0b3e75 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 4 Mar 2023 02:16:41 +0300 Subject: chore(tvix/nix-compat): include invalid hashes in SRI hash error Change-Id: I379b18cb07da0988f8ce4934976ae7d6566d6bb5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8210 Autosubmit: tazjin Tested-by: BuildkiteCI Reviewed-by: flokli --- tvix/nix-compat/src/nixhash.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tvix/nix-compat/src/nixhash.rs') diff --git a/tvix/nix-compat/src/nixhash.rs b/tvix/nix-compat/src/nixhash.rs index 0a7b1b1375..33ffccc52e 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 { 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(); -- cgit 1.4.1