1use aura_core::AuraError;
6
7#[derive(Debug, thiserror::Error)]
9pub enum AgentError {
10 #[error("Agent configuration error: {0}")]
12 Config(String),
13
14 #[error("Agent runtime error: {0}")]
16 Runtime(String),
17
18 #[error("Authority context error: {0}")]
20 Context(String),
21
22 #[error("Effect system error: {0}")]
24 Effects(String),
25
26 #[error("Choreography error: {0}")]
28 Choreography(String),
29
30 #[error("Agent timeout error: {0}")]
32 Timeout(String),
33
34 #[error("Aura error: {0}")]
36 Aura(#[from] AuraError),
37}
38
39pub type AgentResult<T> = std::result::Result<T, AgentError>;
41
42impl AgentError {
43 pub fn config(msg: impl Into<String>) -> Self {
45 Self::Config(msg.into())
46 }
47
48 pub fn runtime(msg: impl Into<String>) -> Self {
50 Self::Runtime(msg.into())
51 }
52
53 pub fn context(msg: impl Into<String>) -> Self {
55 Self::Context(msg.into())
56 }
57
58 pub fn effects(msg: impl Into<String>) -> Self {
60 Self::Effects(msg.into())
61 }
62
63 pub fn choreography(msg: impl Into<String>) -> Self {
65 Self::Choreography(msg.into())
66 }
67
68 pub fn timeout(msg: impl Into<String>) -> Self {
70 Self::Timeout(msg.into())
71 }
72
73 pub fn internal(msg: impl Into<String>) -> Self {
75 Self::Runtime(msg.into())
76 }
77
78 pub fn invalid(msg: impl Into<String>) -> Self {
80 Self::Config(msg.into())
81 }
82}