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("Source handle is empty")]
48    EmptySourceHandle,
49
50    #[error("Target handle is empty")]
51    EmptyTargetHandle,
52
53    #[error("Edge already exists")]
54    EdgeAlreadyExists,
55
56    #[error("Edge {0} not found")]
57    EdgeNotFound(String),
58
59    #[error("Agent flow {0} not found")]
60    FlowNotFound(String),
61
62    #[error("Agent {0} definition not found")]
63    AgentDefinitionNotFound(String),
64
65    #[error("Agent tx for {0} not found")]
66    AgentTxNotFound(String),
67
68    #[error("Failed to send message: {0}")]
69    SendMessageFailed(String),
70
71    #[error("Failed to serialize/deserialize: {0}")]
72    SerializationError(String),
73
74    #[error("Message sender not initialized")]
75    TxNotInitialized,
76
77    #[error("IO error: {0}")]
78    IoError(String),
79
80    #[error("JSON parsing error: {0}")]
81    JsonParseError(String),
82
83    #[error("Invalid file extension: expected JSON")]
84    InvalidFileExtension,
85
86    #[error("Empty file name")]
87    EmptyFileName,
88
89    #[error("Failed to get file stem from path")]
90    FileSystemError,
91
92    #[error("Configuration error: {0}")]
93    InvalidConfig(String),
94
95    #[error("No configuration available")]
96    NoConfig,
97
98    #[error("No global configuration available")]
99    NoGlobalConfig,
100}