1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum ThoughtsError {
6 #[error("Not in a git repository")]
7 NotInGitRepo,
8
9 #[error("Mount source does not exist: {path}")]
10 MountSourceNotFound { path: PathBuf },
11
12 #[error("Platform not supported: {platform}")]
13 PlatformNotSupported { platform: String },
14
15 #[error("Required tool not found: {tool}")]
16 ToolNotFound { tool: String },
17
18 #[error("Mount operation failed: {message}")]
19 MountOperationFailed { message: String },
20
21 #[error("Command timeout: {command} timed out after {timeout_secs} seconds")]
22 CommandTimeout { command: String, timeout_secs: u64 },
23
24 #[error("IO error: {0}")]
25 Io(#[from] std::io::Error),
26
27 #[error("JSON error: {0}")]
28 Json(#[from] serde_json::Error),
29
30 #[error("Git2 error: {0}")]
31 Git2(#[from] git2::Error),
32
33 #[error(transparent)]
34 Other(#[from] anyhow::Error),
35}
36
37pub type Result<T> = std::result::Result<T, ThoughtsError>;