about summary refs log tree commit diff
path: root/tvix/derivation/src/output.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-01-16T14·24+0100
committerflokli <flokli@flokli.de>2023-01-16T23·04+0000
commitd644ed389aab967a276c39b349a8d266a1aee889 (patch)
treed8fa216184906fcfb9db11ff7aae5010d64061bf /tvix/derivation/src/output.rs
parent95cad95b9333214df90d6002e51c7ae34910fa7e (diff)
refactor(tvix/derivation): expose proper ValidateDerivationError r/5668
Use proper errors, instead of anyhow.

Change-Id: I6db14c72a6319b389b0136aac7b84f50a30fb366
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7847
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/derivation/src/output.rs')
-rw-r--r--tvix/derivation/src/output.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/tvix/derivation/src/output.rs b/tvix/derivation/src/output.rs
index 1236cd989f7f..cd77c00f2f41 100644
--- a/tvix/derivation/src/output.rs
+++ b/tvix/derivation/src/output.rs
@@ -1,5 +1,7 @@
 use serde::{Deserialize, Serialize};
-use tvix_store::store_path::StorePath;
+use tvix_store::store_path::{ParseStorePathError, StorePath};
+
+use crate::ValidateDerivationError;
 
 #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
 pub struct Output {
@@ -22,8 +24,10 @@ impl Output {
         self.hash.is_some()
     }
 
-    pub fn validate(&self) -> anyhow::Result<()> {
-        StorePath::from_absolute_path(&self.path)?;
+    pub fn validate(&self) -> Result<(), ParseStorePathError> {
+        if let Err(e) = StorePath::from_absolute_path(&self.path) {
+            return Err(e);
+        }
         Ok(())
     }
 }