1use std::array::TryFromSliceError;
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum DataChunkError {
7 #[error(transparent)]
8 Buffer(#[from] ps_buffer::BufferError),
9 #[error(transparent)]
10 Decryption(#[from] ps_cypher::DecryptionError),
11 #[error(transparent)]
12 Encryption(#[from] ps_cypher::EncryptionError),
13 #[error(transparent)]
14 Hash(#[from] ps_hash::HashError),
15 #[error(transparent)]
16 HashValidation(#[from] ps_hash::HashValidationError),
17 #[error(transparent)]
18 Slice(#[from] TryFromSliceError),
19 #[error("The data chunk was not correctly laid out")]
20 InvalidLayout,
21 #[error("The hash of a chunk was incorrect")]
22 HashMismatch,
23 #[error("Rkyv deserialization failed")]
24 InvalidArchive,
25 #[error("Rkyv serialization failed")]
26 Serialization,
27}
28
29pub type Result<T> = std::result::Result<T, DataChunkError>;