rust_rule_engine/
errors.rs1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum RuleEngineError {
6    #[error("Parse error: {message}")]
8    ParseError {
9        message: String,
11    },
12
13    #[error("Evaluation error: {message}")]
15    EvaluationError {
16        message: String,
18    },
19
20    #[error("Field not found: {field}")]
22    FieldNotFound {
23        field: String,
25    },
26
27    #[error("IO error: {0}")]
29    IoError(#[from] std::io::Error),
30
31    #[error("Type mismatch: expected {expected}, got {actual}")]
33    TypeMismatch {
34        expected: String,
36        actual: String,
38    },
39
40    #[error("Invalid operator: {operator}")]
42    InvalidOperator {
43        operator: String,
45    },
46
47    #[error("Invalid logical operator: {operator}")]
49    InvalidLogicalOperator {
50        operator: String,
52    },
53
54    #[error("Regex error: {message}")]
56    RegexError {
57        message: String,
59    },
60
61    #[error("Action execution error: {message}")]
63    ActionError {
64        message: String,
66    },
67
68    #[error("Execution error: {0}")]
70    ExecutionError(String),
71
72    #[error("Serialization error: {message}")]
74    SerializationError {
75        message: String,
77    },
78
79    #[error("Plugin error: {message}")]
81    PluginError {
82        message: String,
84    },
85}
86
87pub type Result<T> = std::result::Result<T, RuleEngineError>;