diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-03-20 09:27:36 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-03-20 09:30:39 +0200 |
commit | 5e5891771efd0530b1e648c1acb6d673b032e432 (patch) | |
tree | 889930448ab8764dc8f37840da4a07dd750ac3e1 /src/err.rs | |
parent | dcbcbd9457d4bd4d21bcf8dbcc9e416fff463d92 (diff) | |
download | roadmap-5e5891771efd0530b1e648c1acb6d673b032e432.tar.gz |
Change: use anyhow and thiserror for error handling
Diffstat (limited to 'src/err.rs')
-rw-r--r-- | src/err.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/err.rs b/src/err.rs new file mode 100644 index 0000000..6a224a1 --- /dev/null +++ b/src/err.rs @@ -0,0 +1,33 @@ +use serde_yaml; +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), +} |