Skip to main content

fetch/
error.rs

1use std::path::PathBuf;
2
3#[derive(Debug, thiserror::Error)]
4pub enum FetchError {
5    #[error("offline: could not reach {url}")]
6    Offline { url: String },
7    #[error("stalled: no bytes received for 30s from {url}")]
8    Stalled { url: String },
9    #[error("checksum mismatch: expected {expected}, got {got}")]
10    ChecksumMismatch { expected: String, got: String },
11    #[error("http {status} from {url}")]
12    Http { status: u16, url: String },
13    #[error("fetch cancelled")]
14    Cancelled,
15    #[error("io error at {path}: {source}")]
16    Io {
17        path: PathBuf,
18        source: std::io::Error,
19    },
20}