Skip to main content

miniplan/
error.rs

1//! Error types for parsing, grounding, and search operations.
2
3use thiserror::Error;
4
5/// Errors that can occur during planning operations.
6#[derive(Debug, Error)]
7pub enum MiniplanError {
8    /// Failed to parse PDDL input.
9    #[error("failed to parse PDDL: {0}")]
10    Parse(String),
11
12    /// A PDDL requirement is not supported.
13    #[error("unsupported PDDL requirement: {0}")]
14    Unsupported(String),
15
16    /// A type mismatch was detected.
17    #[error("type mismatch: {0}")]
18    TypeMismatch(String),
19
20    /// An error occurred during grounding.
21    #[error("grounding error: {0}")]
22    Ground(String),
23
24    /// A search limit was reached.
25    #[error("search limit reached: {0}")]
26    SearchLimit(String),
27
28    /// No plan was found.
29    #[error("no plan found")]
30    NoPlan,
31
32    /// The planner cannot handle the given task.
33    #[error("planner '{planner}' cannot handle this task; missing capabilities: {missing:?}")]
34    IncapablePlanner {
35        /// Name of the planner.
36        planner: String,
37        /// Description of missing capabilities.
38        missing: String,
39    },
40
41    /// An I/O error occurred.
42    #[error("I/O error: {0}")]
43    Io(#[from] std::io::Error),
44
45    /// The planner name is not registered.
46    #[error("invalid planner name: {0}")]
47    InvalidPlanner(String),
48
49    /// The heuristic name is not registered.
50    #[error("invalid heuristic name: {0}")]
51    InvalidHeuristic(String),
52
53    /// Bidirectional search doesn't support conditional effects.
54    #[error("bidirectional search does not support operators with conditional effects")]
55    UnsupportedConditionalEffects,
56}