Skip to main content

agentry_openclaw/
error.rs

1use std::io;
2
3/// Errors that can occur in the agentry-openclaw crate.
4#[derive(Debug, thiserror::Error)]
5pub enum OpenClawError {
6    /// Failed to parse an OpenClaw configuration file.
7    #[error("failed to parse config at {path}: {reason}")]
8    ConfigParse { path: String, reason: String },
9
10    /// The requested workspace was not found.
11    #[error("workspace not found: {id}")]
12    WorkspaceNotFound { id: String },
13
14    /// Failed to read a documentation file.
15    #[error("failed to read document at {path}")]
16    DocRead {
17        path: String,
18        #[source]
19        source: io::Error,
20    },
21
22    /// Failed to write a documentation file.
23    #[error("failed to write document at {path}")]
24    DocWrite {
25        path: String,
26        #[source]
27        source: io::Error,
28    },
29
30    /// A validation check failed.
31    #[error("validation failed: {reason}")]
32    Validation { reason: String },
33
34    /// General I/O error associated with a specific path.
35    #[error("I/O error for {path}")]
36    Io {
37        path: String,
38        #[source]
39        source: io::Error,
40    },
41}