Skip to main content

objectiveai_cli/filesystem/
error.rs

1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3    #[error("failed to read directory {0}: {1}")]
4    ReadDir(std::path::PathBuf, std::io::Error),
5    #[error("failed to read file {0}: {1}")]
6    Read(std::path::PathBuf, std::io::Error),
7    #[error("failed to parse file {0}: {1}")]
8    Parse(std::path::PathBuf, serde_json::Error),
9    #[error("failed to deserialize file {0} into typed shape: {1}")]
10    TypedDeserialize(std::path::PathBuf, serde_json::Error),
11    #[error("subscribe timed out")]
12    LogSubscribeTimedOut,
13    #[error("file {0} is not valid UTF-8: {1}")]
14    Utf8(std::path::PathBuf, std::string::FromUtf8Error),
15    #[error("failed to serialize: {0}")]
16    Serialize(serde_json::Error),
17    /// Generic inline JSON encode/decode. Used by the queue
18    /// content-row reader where the offending bytes don't have a
19    /// path attached (they came from a SQLite column).
20    #[error("inline JSON error: {0}")]
21    Json(#[from] serde_json::Error),
22    #[error("failed to write file {0}: {1}")]
23    Write(std::path::PathBuf, std::io::Error),
24    #[error("not found: {0}")]
25    NotFound(String),
26    #[error("invalid path: {0}")]
27    InvalidPath(String),
28    #[error("index {0} out of bounds (len {1})")]
29    IndexOutOfBounds(usize, usize),
30    #[error("jq parse error: {0}")]
31    JqParse(String),
32    #[error("jq compile error: {0}")]
33    JqCompile(String),
34    #[error("jq runtime error: {0}")]
35    JqRuntime(String),
36    #[error(
37        "invalid repository name (alphanumeric and dashes only, max 100 chars): {0}"
38    )]
39    InvalidRepositoryName(String),
40    #[error("io error: {0}")]
41    Io(#[from] std::io::Error),
42    #[error("git error: {0}")]
43    Git(#[from] git2::Error),
44    #[error("install error: {0}")]
45    Install(#[from] crate::filesystem::install::InstallError),
46}