hierconf_core/error.rs
1use facet::{Facet, Shape};
2use facet_error as error;
3use facet_toml::{DeserializeError, TomlError};
4
5/// Errors that can occur in hierconf.
6#[repr(u8)]
7#[derive(Facet, Debug)]
8#[facet(derive(Error))]
9pub enum HierConfError {
10 /// IO error: {0}
11 #[facet(error::from)]
12 Io(#[facet(opaque)] std::io::Error),
13 /// Error during TOML deserialization: {0}
14 #[facet(error::from)]
15 Toml(#[facet(opaque)] DeserializeError<TomlError>),
16 /// Missing required attribute: {0}
17 MissingAttribute(String),
18 /// Shape mismatch for attribute hierconf::{key}: found shape {shape:?}
19 AttributeShapeMismatch {
20 /// The shape that was found
21 #[facet(opaque)]
22 shape: &'static Shape,
23 /// The attribute key
24 key: &'static str,
25 },
26 /// No configuration files found at any of the checked locations: {locations:?}
27 NoConfigFiles {
28 /// The list of locations that were checked
29 locations: Vec<camino::Utf8PathBuf>,
30 },
31}