xet_data/file_reconstruction/
error.rs1use std::sync::Arc;
2
3use thiserror::Error;
4
5#[non_exhaustive]
7#[derive(Error, Debug, Clone)]
8pub enum FileReconstructionError {
9 #[error("CAS Client Error: {0}")]
10 ClientError(Arc<xet_client::ClientError>),
11
12 #[error("IO Error: {0}")]
13 IoError(Arc<std::io::Error>),
14
15 #[error("Task Runtime Error: {0}")]
16 TaskRuntimeError(Arc<xet_runtime::utils::RwTaskLockError>),
17
18 #[error("Corrupted Reconstruction: {0}")]
19 CorruptedReconstruction(String),
20
21 #[error("Configuration Error: {0}")]
22 ConfigurationError(String),
23
24 #[error("Internal Writer Error: {0}")]
25 InternalWriterError(String),
26
27 #[error("Internal Error: {0}")]
28 InternalError(String),
29
30 #[error("Task Join Error: {0}")]
31 TaskJoinError(Arc<tokio::task::JoinError>),
32
33 #[error("Runtime Error: {0}")]
34 RuntimeError(Arc<xet_runtime::RuntimeError>),
35}
36
37pub type Result<T> = std::result::Result<T, FileReconstructionError>;
38
39impl From<std::io::Error> for FileReconstructionError {
40 fn from(err: std::io::Error) -> Self {
41 FileReconstructionError::IoError(Arc::new(err))
42 }
43}
44
45impl From<xet_client::ClientError> for FileReconstructionError {
46 fn from(err: xet_client::ClientError) -> Self {
47 FileReconstructionError::ClientError(Arc::new(err))
48 }
49}
50
51impl From<xet_runtime::utils::RwTaskLockError> for FileReconstructionError {
52 fn from(err: xet_runtime::utils::RwTaskLockError) -> Self {
53 FileReconstructionError::TaskRuntimeError(Arc::new(err))
54 }
55}
56
57impl From<tokio::task::JoinError> for FileReconstructionError {
58 fn from(err: tokio::task::JoinError) -> Self {
59 FileReconstructionError::TaskJoinError(Arc::new(err))
60 }
61}
62
63impl From<xet_runtime::RuntimeError> for FileReconstructionError {
64 fn from(err: xet_runtime::RuntimeError) -> Self {
65 FileReconstructionError::RuntimeError(Arc::new(err))
66 }
67}