Skip to main content

zlayer_storage/
error.rs

1//! Error types for layer storage
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum LayerStorageError {
7    #[error("IO error: {0}")]
8    Io(#[from] std::io::Error),
9
10    #[error("S3 error: {0}")]
11    S3(String),
12
13    #[error("Serialization error: {0}")]
14    Serialization(#[from] serde_json::Error),
15
16    #[error("Database error: {0}")]
17    Database(String),
18
19    #[error("Checksum mismatch: expected {expected}, got {actual}")]
20    ChecksumMismatch { expected: String, actual: String },
21
22    #[error("Layer not found: {0}")]
23    NotFound(String),
24
25    #[error("Upload interrupted: {0}")]
26    UploadInterrupted(String),
27
28    #[error("Invalid state: {0}")]
29    InvalidState(String),
30}
31
32pub type Result<T> = std::result::Result<T, LayerStorageError>;