about summary refs log tree commit diff
path: root/tvix/castore/src
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2023-10-10T22·06+0000
committeredef <edef@edef.eu>2023-10-10T22·40+0000
commit930edb69d7447f0cbe9149d01dcf9fa8443518c8 (patch)
tree20cf18786b208fb9c701c72b6a61dc7f99969652 /tvix/castore/src
parentbaae5ce473ed83f35f343656eedb14bb60fbecc7 (diff)
fix(tvix/castore): use bstr for formatting names in errors r/6778
Much friendlier than either Base64 or raw byte slices.

Change-Id: I9b4cdd57c83ddc76c0be8103da4320207657a72b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9622
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/castore/src')
-rw-r--r--tvix/castore/src/proto/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tvix/castore/src/proto/mod.rs b/tvix/castore/src/proto/mod.rs
index ba3fcbceb14d..66ed5b0f1f89 100644
--- a/tvix/castore/src/proto/mod.rs
+++ b/tvix/castore/src/proto/mod.rs
@@ -1,6 +1,6 @@
 #![allow(clippy::derive_partial_eq_without_eq, non_snake_case)]
 // https://github.com/hyperium/tonic/issues/1056
-use data_encoding::BASE64;
+use bstr::ByteSlice;
 use std::{collections::HashSet, iter::Peekable};
 use thiserror::Error;
 
@@ -29,13 +29,13 @@ mod tests;
 #[derive(Debug, PartialEq, Eq, Error)]
 pub enum ValidateDirectoryError {
     /// Elements are not in sorted order
-    #[error("{} is not sorted", std::str::from_utf8(.0).unwrap_or(&BASE64.encode(.0)))]
+    #[error("{:?} is not sorted", .0.as_bstr())]
     WrongSorting(Vec<u8>),
     /// Multiple elements with the same name encountered
-    #[error("{0:?} is a duplicate name")]
+    #[error("{:?} is a duplicate name", .0.as_bstr())]
     DuplicateName(Vec<u8>),
     /// Invalid name encountered
-    #[error("Invalid name in {0:?}")]
+    #[error("Invalid name in {:?}", .0.as_bstr())]
     InvalidName(Vec<u8>),
     /// Invalid digest length encountered
     #[error("Invalid Digest length: {0}")]