casc_storage/
error.rs

1//! Error types for CASC storage operations
2
3use std::io;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum CascError {
8    #[error("IO error: {0}")]
9    Io(#[from] io::Error),
10
11    #[error("Index not found for bucket {0:02x}")]
12    IndexNotFound(u8),
13
14    #[error("Entry not found for EKey {0}")]
15    EntryNotFound(String),
16
17    #[error("Archive {0} not found")]
18    ArchiveNotFound(u16),
19
20    #[error("Invalid index format: {0}")]
21    InvalidIndexFormat(String),
22
23    #[error("Invalid archive format: {0}")]
24    InvalidArchiveFormat(String),
25
26    #[error("Checksum mismatch: expected {expected}, got {actual}")]
27    ChecksumMismatch { expected: String, actual: String },
28
29    #[error("Invalid bucket index: {0}")]
30    InvalidBucketIndex(u8),
31
32    #[error("Archive size exceeded: {size} > {max}")]
33    ArchiveSizeExceeded { size: u64, max: u64 },
34
35    #[error("Decompression error: {0}")]
36    DecompressionError(String),
37
38    #[error("Encryption key not found: {0}")]
39    KeyNotFound(String),
40
41    #[error("Storage is read-only")]
42    ReadOnly,
43
44    #[error("Storage verification failed: {0}")]
45    VerificationFailed(String),
46
47    #[error("BLTE error: {0}")]
48    Blte(#[from] blte::error::Error),
49
50    #[error("Manifest not loaded: {0}")]
51    ManifestNotLoaded(String),
52
53    #[error("Invalid format: {0}")]
54    InvalidFormat(String),
55}
56
57pub type Result<T> = std::result::Result<T, CascError>;