use goliath_rule::PathError;
use goliath_sigma::YamlError;
use thiserror::Error;
#[derive(Debug, Clone, PartialEq, Eq, Error)]
#[non_exhaustive]
pub enum DefinitionError {
#[error(transparent)]
Yaml(#[from] YamlError),
#[error("kind `{kind}`: target `{target}`: {source}")]
Target {
kind: String,
target: String,
source: PathError,
},
#[error("kind `{kind}`: source path `{path}` has an empty segment")]
SourcePath {
kind: String,
path: String,
},
#[error("kind `{kind}`: targets `{first}` and `{second}` overlap")]
Overlap {
kind: String,
first: String,
second: String,
},
#[error("kind `{kind}`: `{target}` is set by {reason}, not by a field")]
Reserved {
kind: String,
target: String,
reason: &'static str,
},
#[error("kind `{kind}` has no `when` condition")]
Unconditional {
kind: String,
},
#[error("the definition has no kinds")]
NoKinds,
}