Skip to main content

snix_build_glue/fetchers/
error.rs

1use nix_compat::nixhash::NixHash;
2use nix_compat::store_path;
3use snix_castore::import;
4use url::Url;
5
6#[derive(Debug, thiserror::Error)]
7pub enum FetcherError {
8    #[error("hash mismatch in file downloaded from {url}:\n  wanted: {wanted}\n     got: {got}")]
9    HashMismatch {
10        url: Url,
11        wanted: NixHash,
12        got: NixHash,
13    },
14
15    #[error("Invalid hash type '{0}' for fetcher")]
16    InvalidHashType(&'static str),
17
18    #[error("Unable to parse URL: {0}")]
19    InvalidUrl(#[from] url::ParseError),
20
21    #[error(transparent)]
22    Http(#[from] reqwest::Error),
23
24    #[error(transparent)]
25    Io(#[from] std::io::Error),
26
27    #[error(transparent)]
28    Import(#[from] snix_castore::import::IngestionError<import::archive::Error>),
29
30    #[error("Error calculating store path for fetcher output: {0}")]
31    StorePath(#[from] store_path::ParseStorePathError),
32}