mechanism_runtime/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Clone, PartialEq, Eq, Error)]
5pub enum MechanismValidationError {
6 #[error("missing required field: {0}")]
7 MissingField(&'static str),
8 #[error("invalid artifact state: {0}")]
9 InvalidState(&'static str),
10}
11
12impl MechanismValidationError {
13 pub fn kind(&self) -> &'static str {
14 match self {
15 Self::MissingField(..) => "missing_field",
16 Self::InvalidState(..) => "invalid_state",
17 }
18 }
19}
20
21pub type MechanismValidationResult = Result<(), MechanismValidationError>;