1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use thiserror::Error;

/// Errors that can be returned for roadmaps.
#[derive(Error, Debug)]
pub enum RoadmapError {
    #[error("roadmap has no goals, must have exactly one")]
    NoGoals,

    #[error("too many goals, must have exactly one: found {count:}: {}", .names.join(", "))]
    ManyGoals {
        count: usize,
        names: Vec<String>,
    },

    #[error("step {name:} depends on missing {missing:}")]
    MissingDep {
        name: String,
        missing: String,
    },

    #[error("step is not a mapping")]
    StepNotMapping,

    #[error("'depends' must be a list of step names")]
    DependsNotNames,

    #[error("unknown status: {0}")]
    UnknownStatus(String),

    #[error(transparent)]
    SerdeError(#[from] serde_yaml::Error),
}