1#[derive(Debug, thiserror::Error)]
5pub enum DevToolError {
6 #[error("path '{0}' escapes the workspace root")]
8 PathEscape(String),
9
10 #[error("workspace is read-only; '{0}' is not permitted")]
12 ReadOnly(&'static str),
13
14 #[error("bash execution is disabled for this workspace")]
16 BashDisabled,
17
18 #[error("file '{0}' must be read with read_file before it can be edited")]
20 NotRead(String),
21
22 #[error("no occurrence of the target string was found in '{0}'")]
24 NoMatch(String),
25
26 #[error(
28 "the target string occurs {count} times in '{path}'; pass replace_all=true \
29 or provide a more specific string"
30 )]
31 Ambiguous {
32 path: String,
34 count: usize,
36 },
37
38 #[error("command timed out after {0:?}")]
40 Timeout(std::time::Duration),
41
42 #[error(transparent)]
44 Io(#[from] std::io::Error),
45
46 #[error("{0}")]
48 Other(String),
49}
50
51impl From<DevToolError> for adk_core::AdkError {
52 fn from(e: DevToolError) -> Self {
53 adk_core::AdkError::tool(e.to_string())
54 }
55}