1use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum WorldInfoError {
6 #[error("Parser error: {0}")]
7 ParserError(ParserError),
8 #[error("Processor error: {0}")]
9 ProcessorError(String),
10 #[error("Evaluation error: {0}")]
11 EvaluationError(String),
12}
13
14#[derive(Error, Debug)]
16pub enum ParserError {
17 #[error("Parsing error: {0}")]
19 PestParse(#[from] pest::error::Error<Rule>),
20
21 #[error("JSON processing error: {0}")]
23 Json(#[from] serde_json::Error),
24
25 #[error("Processor '{0}' not found or failed to instantiate: {1}")]
27 ProcessorInstantiation(String, String), #[error("Invalid parsing rule encountered: {0:?}")]
31 InvalidRule(Rule),
32
33 #[error("Processor execution failed: {0}")]
36 ProcessorExecution(String), #[error("Trigger tag missing 'id' attribute: {0}")]
40 MissingTriggerId(String),
41
42 #[error("Processing error: {0}")]
43 Processing(String),
44
45 #[error("Undefined variable: {0}")]
46 UndefinedVariable(String),
47
48 #[error("Variable already exists: {0}")]
49 VariableAlreadyExists(String),
50
51 #[error("Insufficient permissions: {0}")]
52 InsufficientPermissions(String),
53
54 #[error("Type error: {0}")]
55 TypeError(String),
56
57 #[error("Evaluation error: {0}")] Evaluation(String),
59
60 #[error("Internal parser error: {0}")]
61 Internal(String),
62
63 #[error("Regex compilation error: {0}")]
64 RegexCompilation(String, String),
65}
66
67use crate::parser::Rule;