modular_agent_core/
error.rs1use thiserror::Error;
2
3#[derive(Clone, Debug, Error)]
19pub enum AgentError {
20 #[error("Invalid {0} value in array")]
22 InvalidArrayValue(String),
23
24 #[error("{0}: Agent definition \"{1}\" is invalid")]
26 InvalidDefinition(String, String),
27
28 #[error("Invalid port: {0}")]
30 InvalidPin(String),
31
32 #[error("Invalid preset name: {0}")]
34 InvalidPresetName(String),
35
36 #[error("Invalid {0} value")]
38 InvalidValue(String),
39
40 #[error("{0}: Agent definition \"{1}\" is missing")]
42 MissingDefinition(String, String),
43
44 #[error("Failed to rename preset: {0}")]
46 RenamePresetFailed(String),
47
48 #[error("Unknown agent def kind: {0}")]
50 UnknownDefKind(String),
51
52 #[error("Unknown agent def name: {0}")]
54 UnknownDefName(String),
55
56 #[error("Agent definition \"{0}\" is not implemented")]
58 NotImplemented(String),
59
60 #[error("Agent {0} already exists")]
62 AgentAlreadyExists(String),
63
64 #[error("Failed to create agent {0}")]
66 AgentCreationFailed(String),
67
68 #[error("Agent {0} not found")]
70 AgentNotFound(String),
71
72 #[error("Source agent {0} not found")]
74 SourceAgentNotFound(String),
75
76 #[error("Duplicate id: {0}")]
78 DuplicateId(String),
79
80 #[error("Source handle is empty")]
82 EmptySourceHandle,
83
84 #[error("Target handle is empty")]
86 EmptyTargetHandle,
87
88 #[error("Connection already exists")]
90 ConnectionAlreadyExists,
91
92 #[error("Connection {0} not found")]
94 ConnectionNotFound(String),
95
96 #[error("Preset {0} not found")]
98 PresetNotFound(String),
99
100 #[error("Agent {0} definition not found")]
102 AgentDefinitionNotFound(String),
103
104 #[error("Agent tx for {0} not found")]
106 AgentTxNotFound(String),
107
108 #[error("Failed to send message: {0}")]
110 SendMessageFailed(String),
111
112 #[error("Failed to serialize/deserialize: {0}")]
114 SerializationError(String),
115
116 #[error("Message sender not initialized")]
118 TxNotInitialized,
119
120 #[error("IO error: {0}")]
122 IoError(String),
123
124 #[error("JSON parsing error: {0}")]
126 JsonParseError(String),
127
128 #[error("Invalid file extension: expected JSON")]
130 InvalidFileExtension,
131
132 #[error("Empty file name")]
134 EmptyFileName,
135
136 #[error("Failed to get file stem from path")]
138 FileSystemError,
139
140 #[error("Configuration error: {0}")]
142 InvalidConfig(String),
143
144 #[error("No configuration available")]
146 NoConfig,
147
148 #[error("Unknown configuration: {0}")]
150 UnknownConfig(String),
151
152 #[error("No global configuration available")]
154 NoGlobalConfig,
155
156 #[error("Pin not found: {0}")]
158 PinNotFound(String),
159
160 #[error("Agent error: {0}")]
162 Other(String),
163}