1use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum GenError {
9 #[error("failed to read spec {path}: {source}")]
11 ReadSpec {
12 path: PathBuf,
14 #[source]
16 source: std::io::Error,
17 },
18
19 #[error("failed to write {path}: {source}")]
21 WriteOutput {
22 path: PathBuf,
24 #[source]
26 source: std::io::Error,
27 },
28
29 #[error("parse error ({kind}): {message}")]
31 Parse {
32 kind: &'static str,
34 message: String,
36 },
37
38 #[error("json error: {0}")]
40 Json(#[from] serde_json::Error),
41
42 #[error("yaml error: {0}")]
44 Yaml(#[from] serde_yaml::Error),
45
46 #[error(transparent)]
48 Other(#[from] anyhow::Error),
49}
50
51pub type Result<T> = std::result::Result<T, GenError>;