1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum Error {
8 #[error("No workspace context set. Call set_context first.")]
10 NoContext,
11
12 #[error("Invalid {field}: '{value}'. Valid values: {valid_values}")]
14 InvalidArgument {
15 field: &'static str,
17 value: String,
19 valid_values: &'static str,
21 },
22
23 #[error("Issue not found: {0}")]
25 IssueNotFound(String),
26
27 #[error("Workspace not found: {path}")]
29 WorkspaceNotFound {
30 path: String,
32 #[source]
34 source: Option<std::io::Error>,
35 },
36
37 #[error("Workspace not initialized: {0}. Call set_context first.")]
39 WorkspaceNotInitialized(String),
40
41 #[error("No .rivets directory found in {0} or parent directories")]
43 NoRivetsDirectory(String),
44
45 #[error("Failed to load config from '{path}': {reason}. Run 'rivets init' to create a valid configuration.")]
47 ConfigLoad {
48 path: String,
50 reason: String,
52 },
53
54 #[error("Storage error: {0}")]
56 Storage(#[from] rivets::error::Error),
57
58 #[error("I/O error: {0}")]
60 Io(#[from] std::io::Error),
61
62 #[error("JSON error: {0}")]
64 Json(#[from] serde_json::Error),
65
66 #[error("MCP error: {0}")]
68 Mcp(String),
69}
70
71pub type Result<T> = std::result::Result<T, Error>;