Skip to main content

nix_compat/derivation/
errors.rs

1//! Contains [DerivationError], exported as [crate::derivation::DerivationError]
2use crate::store_path;
3use thiserror::Error;
4
5/// Errors that can occur during the validation of Derivation structs.
6#[derive(Debug, Error, PartialEq)]
7pub enum DerivationError {
8    #[error("unable to parse derivation name {0}: {1}")]
9    InvalidDerivationName(String, #[source] store_path::ParseStorePathError),
10
11    // outputs
12    #[error("{0}")]
13    InvalidOutputs(
14        #[from]
15        #[source]
16        super::outputs::OutputsError,
17    ),
18    // input derivation
19    #[error("unable to parse input derivation path {0}: {1}")]
20    InvalidInputDerivationPath(String, #[source] store_path::ParseStorePathError),
21    #[error("input derivation {0} doesn't end with .drv")]
22    InvalidInputDerivationPrefix(String),
23    #[error("input derivation {0} output names are empty")]
24    EmptyInputDerivationOutputNames(String),
25    #[error("input derivation {0} output name {1} is invalid")]
26    InvalidInputDerivationOutputName(String, String),
27
28    // input sources
29    #[error("unable to parse input sources path {0}: {1}")]
30    InvalidInputSourcesPath(String, #[source] store_path::ParseStorePathError),
31
32    // platform
33    #[error("invalid platform field: {0}")]
34    InvalidPlatform(String),
35
36    // builder
37    #[error("invalid builder field: {0}")]
38    InvalidBuilder(String),
39
40    // environment
41    #[error("invalid environment key {0}")]
42    InvalidEnvironmentKey(String),
43}