weirdnet_rules/error.rs
1/// A rule, condition, pattern or schedule that does not parse.
2#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
3pub enum RulesError {
4 #[error("invalid {what}: {msg}")]
5 Invalid { what: &'static str, msg: String },
6}
7
8impl RulesError {
9 pub fn invalid(what: &'static str, msg: impl Into<String>) -> Self {
10 RulesError::Invalid { what, msg: msg.into() }
11 }
12}
13
14pub type Result<T> = std::result::Result<T, RulesError>;