agentic_planning/
error.rs1use crate::types::{
2 CommitmentId, CommitmentStatus, DecisionId, DecisionStatus, DreamId, FederationId, GoalId,
3 GoalStatus, PathId,
4};
5use thiserror::Error;
6
7#[derive(Debug, Error)]
8pub enum Error {
9 #[error("goal not found: {0:?}")]
10 GoalNotFound(GoalId),
11
12 #[error("decision not found: {0:?}")]
13 DecisionNotFound(DecisionId),
14
15 #[error("commitment not found: {0:?}")]
16 CommitmentNotFound(CommitmentId),
17
18 #[error("dream not found: {0:?}")]
19 DreamNotFound(DreamId),
20
21 #[error("federation not found: {0:?}")]
22 FederationNotFound(FederationId),
23
24 #[error("soul archive not found: {0:?}")]
25 SoulNotFound(GoalId),
26
27 #[error("path not found: {0:?}")]
28 PathNotFound(PathId),
29
30 #[error("invalid transition from {from:?} to {to:?}")]
31 InvalidTransition { from: GoalStatus, to: GoalStatus },
32
33 #[error("cannot complete goal in state {0:?}")]
34 CannotComplete(GoalStatus),
35
36 #[error("cannot break commitment in state {0:?}")]
37 CannotBreak(CommitmentStatus),
38
39 #[error("decision already crystallized")]
40 AlreadyCrystallized,
41
42 #[error("cannot recrystallize decision in state {0:?}")]
43 CannotRecrystallize(DecisionStatus),
44
45 #[error("cannot fulfill commitment in state {0:?}")]
46 CannotFulfill(CommitmentStatus),
47
48 #[error("validation error: {0}")]
49 Validation(String),
50
51 #[error("invalid .aplan file")]
52 InvalidFile,
53
54 #[error("corrupted .aplan file: {0}")]
55 CorruptedFile(String),
56
57 #[error("io error: {0}")]
58 Io(#[from] std::io::Error),
59
60 #[error("serialization error: {0}")]
61 Serde(#[from] serde_json::Error),
62}
63
64pub type Result<T> = std::result::Result<T, Error>;