about summary refs log tree commit diff
path: root/tvix/store/src
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/store/src')
-rw-r--r--tvix/store/src/nar/mod.rs4
-rw-r--r--tvix/store/src/nar/renderer.rs25
2 files changed, 13 insertions, 16 deletions
diff --git a/tvix/store/src/nar/mod.rs b/tvix/store/src/nar/mod.rs
index 25a9e18826c8..c1a7fc2a933f 100644
--- a/tvix/store/src/nar/mod.rs
+++ b/tvix/store/src/nar/mod.rs
@@ -1,5 +1,5 @@
 use data_encoding::BASE64;
-use tvix_castore::{B3Digest, Error};
+use tvix_castore::B3Digest;
 
 mod import;
 mod renderer;
@@ -11,7 +11,7 @@ pub use renderer::write_nar;
 #[derive(Debug, thiserror::Error)]
 pub enum RenderError {
     #[error("failure talking to a backing store client: {0}")]
-    StoreError(Error),
+    StoreError(#[source] std::io::Error),
 
     #[error("unable to find directory {}, referred from {:?}", .0, .1)]
     DirectoryNotFound(B3Digest, bytes::Bytes),
diff --git a/tvix/store/src/nar/renderer.rs b/tvix/store/src/nar/renderer.rs
index 2904f912fc14..f510a9c76e60 100644
--- a/tvix/store/src/nar/renderer.rs
+++ b/tvix/store/src/nar/renderer.rs
@@ -10,12 +10,10 @@ use std::{
 };
 use tokio::io::{self, AsyncWrite, BufReader};
 use tokio_util::compat::{TokioAsyncReadCompatExt, TokioAsyncWriteCompatExt};
-use tracing::warn;
 use tvix_castore::{
     blobservice::BlobService,
     directoryservice::DirectoryService,
     proto::{self as castorepb, NamedNode},
-    Error,
 };
 
 /// Invoke [write_nar], and return the size and sha256 digest of the produced
@@ -110,14 +108,11 @@ async fn walk_node(
                 .map_err(RenderError::NARWriterError)?;
         }
         castorepb::node::Node::File(proto_file_node) => {
-            let digest = proto_file_node.digest.clone().try_into().map_err(|_e| {
-                warn!(
-                    file_node = ?proto_file_node,
-                    "invalid digest length in file node",
-                );
-
-                RenderError::StoreError(Error::StorageError(
-                    "invalid digest len in file node".to_string(),
+            let digest_len = proto_file_node.digest.len();
+            let digest = proto_file_node.digest.clone().try_into().map_err(|_| {
+                RenderError::StoreError(io::Error::new(
+                    io::ErrorKind::Other,
+                    format!("invalid digest len {} in file node", digest_len),
                 ))
             })?;
 
@@ -143,13 +138,15 @@ async fn walk_node(
                 .map_err(RenderError::NARWriterError)?;
         }
         castorepb::node::Node::Directory(proto_directory_node) => {
+            let digest_len = proto_directory_node.digest.len();
             let digest = proto_directory_node
                 .digest
                 .clone()
                 .try_into()
-                .map_err(|_e| {
-                    RenderError::StoreError(Error::StorageError(
-                        "invalid digest len in directory node".to_string(),
+                .map_err(|_| {
+                    RenderError::StoreError(io::Error::new(
+                        io::ErrorKind::InvalidData,
+                        format!("invalid digest len {} in directory node", digest_len),
                     ))
                 })?;
 
@@ -157,7 +154,7 @@ async fn walk_node(
             match directory_service
                 .get(&digest)
                 .await
-                .map_err(RenderError::StoreError)?
+                .map_err(|e| RenderError::StoreError(e.into()))?
             {
                 // if it's None, that's an error!
                 None => {