Skip to main content

arcbox_asset/
error.rs

1//! Error types for asset operations.
2
3/// Errors that can occur during asset download, verification, or caching.
4#[derive(Debug, thiserror::Error)]
5pub enum AssetError {
6    /// SHA-256 checksum mismatch after download.
7    #[error("sha256 mismatch for '{name}': expected {expected}, got {actual}")]
8    ChecksumMismatch {
9        name: String,
10        expected: String,
11        actual: String,
12    },
13
14    /// HTTP or network-level download failure.
15    #[error("download failed: {0}")]
16    Download(String),
17
18    /// Filesystem I/O error.
19    #[error("io error: {0}")]
20    Io(#[from] std::io::Error),
21}
22
23pub type Result<T> = std::result::Result<T, AssetError>;