refactor(tvix/castore): have PathComponent-specific errors
Don't use DirectoryError, but PathComponentError. Also add checks for too long path components. Change-Id: Ia9deb9dd0351138baadb2e9c9454c3e019d5a45e Reviewed-on: https://cl.tvl.fyi/c/depot/+/12229 Tested-by: BuildkiteCI Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com> Autosubmit: flokli <flokli@flokli.de> Reviewed-by: edef <edef@edef.eu>
This commit is contained in:
parent
0cfe2aaf6a
commit
56fa533e43
6 changed files with 246 additions and 76 deletions
|
|
@ -3,7 +3,7 @@ use thiserror::Error;
|
|||
use tokio::task::JoinError;
|
||||
use tonic::Status;
|
||||
|
||||
use crate::path::PathComponent;
|
||||
use crate::path::{PathComponent, PathComponentError};
|
||||
|
||||
/// Errors related to communication with the store.
|
||||
#[derive(Debug, Error, PartialEq)]
|
||||
|
|
@ -47,8 +47,8 @@ pub enum DirectoryError {
|
|||
#[error("Total size exceeds u32::MAX")]
|
||||
SizeOverflow,
|
||||
/// Invalid name encountered
|
||||
#[error("Invalid name: {}", .0.as_bstr())]
|
||||
InvalidName(bytes::Bytes),
|
||||
#[error("Invalid name: {0}")]
|
||||
InvalidName(PathComponentError),
|
||||
/// Elements are not in sorted order. Can only happen on protos
|
||||
#[error("{:?} is not sorted", .0.as_bstr())]
|
||||
WrongSorting(bytes::Bytes),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue