diff options
author | Florian Klink <flokli@flokli.de> | 2023-01-31T23·30+0100 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-02-01T15·29+0000 |
commit | 99d5cf822a969c5de54639e46f9be917b7cd6119 (patch) | |
tree | 1ab1966038244000d08b2651105caccbefacf23b /tvix/cli/src/errors.rs | |
parent | 265dd36b9819031e83342b4c2bf061f3c6bae22e (diff) |
refactor(tvix/cli): use nixhash module for output hash calculation r/5807
This covers all the weird corner cases. Change-Id: I85637e82e8929828064ab562dc8a1c8bf161fffa Reviewed-on: https://cl.tvl.fyi/c/depot/+/7991 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to '')
-rw-r--r-- | tvix/cli/src/errors.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/tvix/cli/src/errors.rs b/tvix/cli/src/errors.rs index 5315b2486420..6f328dc0003c 100644 --- a/tvix/cli/src/errors.rs +++ b/tvix/cli/src/errors.rs @@ -1,9 +1,9 @@ -use nix_compat::derivation::DerivationError; +use nix_compat::{derivation::DerivationError, nixhash}; use std::rc::Rc; use thiserror::Error; /// Errors related to derivation construction -#[derive(Debug, Error, PartialEq)] +#[derive(Debug, Error)] pub enum Error { #[error("an output with the name '{0}' is already defined")] DuplicateOutput(String), @@ -15,18 +15,10 @@ pub enum Error { ShadowedOutput(String), #[error("invalid derivation parameters: {0}")] InvalidDerivation(DerivationError), + #[error("invalid output hash: {0}")] + InvalidOutputHash(nixhash::Error), #[error("invalid output hash mode: '{0}', only 'recursive' and 'flat` are supported")] InvalidOutputHashMode(String), - #[error("unsupported sri algorithm: {0}, only sha1, sha256 or sha512 is supported")] - UnsupportedSRIAlgo(String), - #[error("invalid number of sri hashes in string ({0}), only one hash is supported")] - UnsupportedSRIMultiple(usize), - #[error("invalid sri digest: {0}")] - InvalidSRIDigest(data_encoding::DecodeError), - #[error("failed to parse SRI string: {0}")] - InvalidSRIString(String), - #[error("outputHashAlgo is set to {0}, but outputHash contains SRI with algo {1}")] - ConflictingSRIHashAlgo(String, String), } impl From<Error> for tvix_eval::ErrorKind { |