agent_stream_kit/
error.rs

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