agent_stream_kit/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum AgentError {
5    #[error("Agent flow {0} already exists")]
6    DuplicateFlowName(String),
7
8    #[error("Invalid {0} value in array")]
9    InvalidArrayValue(String),
10
11    #[error("{0}: Agent definition \"{1}\" is invalid")]
12    InvalidDefinition(String, String),
13
14    #[error("Invalid agent flow name: {0}")]
15    InvalidFlowName(String),
16
17    #[error("Invalid {0} value")]
18    InvalidValue(String),
19
20    #[error("{0}: Agent definition \"{1}\" is missing")]
21    MissingDefinition(String, String),
22
23    #[error("Failed to rename agent flow: {0}")]
24    RenameFlowFailed(String),
25
26    #[error("Unknown agent def kind: {0}")]
27    UnknownDefKind(String),
28
29    #[error("Unknown agent def name: {0}")]
30    UnknownDefName(String),
31
32    #[error("Agent definition \"{0}\" is not implemented")]
33    NotImplemented(String),
34
35    #[error("Agent {0} already exists")]
36    AgentAlreadyExists(String),
37
38    #[error("Failed to create agent {0}")]
39    AgentCreationFailed(String),
40
41    #[error("Agent {0} not found")]
42    AgentNotFound(String),
43
44    #[error("Source agent {0} not found")]
45    SourceAgentNotFound(String),
46
47    #[error("Duplicate id: {0}")]
48    DuplicateId(String),
49
50    #[error("Source handle is empty")]
51    EmptySourceHandle,
52
53    #[error("Target handle is empty")]
54    EmptyTargetHandle,
55
56    #[error("Edge already exists")]
57    EdgeAlreadyExists,
58
59    #[error("Edge {0} not found")]
60    EdgeNotFound(String),
61
62    #[error("Agent flow {0} not found")]
63    FlowNotFound(String),
64
65    #[error("Agent {0} definition not found")]
66    AgentDefinitionNotFound(String),
67
68    #[error("Agent tx for {0} not found")]
69    AgentTxNotFound(String),
70
71    #[error("Failed to send message: {0}")]
72    SendMessageFailed(String),
73
74    #[error("Failed to serialize/deserialize: {0}")]
75    SerializationError(String),
76
77    #[error("Message sender not initialized")]
78    TxNotInitialized,
79
80    #[error("IO error: {0}")]
81    IoError(String),
82
83    #[error("JSON parsing error: {0}")]
84    JsonParseError(String),
85
86    #[error("Invalid file extension: expected JSON")]
87    InvalidFileExtension,
88
89    #[error("Empty file name")]
90    EmptyFileName,
91
92    #[error("Failed to get file stem from path")]
93    FileSystemError,
94
95    #[error("Configuration error: {0}")]
96    InvalidConfig(String),
97
98    #[error("No configuration available")]
99    NoConfig,
100
101    #[error("Unknown configuration: {0}")]
102    UnknownConfig(String),
103
104    #[error("No global configuration available")]
105    NoGlobalConfig,
106
107    #[error("Pin not found: {0}")]
108    PinNotFound(String),
109
110    #[error("Agent error: {0}")]
111    Other(String),
112}