1use crate::agents::RunError;
2use std::path::PathBuf;
3use thiserror::Error;
4use utils::git::GitError;
5
6#[derive(Debug, Error)]
7pub enum WorkspaceError {
8 #[error("failed to create temporary directory: {0}")]
9 CreateTempDir(#[source] std::io::Error),
10
11 #[error("failed to copy fixture directory from '{}' to '{}': {source}", from.display(), to.display())]
12 CopyFixture {
13 from: PathBuf,
14 to: PathBuf,
15 #[source]
16 source: std::io::Error,
17 },
18
19 #[error("failed to write workspace file '{}': {source}", path.display())]
20 WriteFile {
21 path: PathBuf,
22 #[source]
23 source: std::io::Error,
24 },
25
26 #[error("failed to resolve path '{}': {source}", path.display())]
27 ResolvePath {
28 path: PathBuf,
29 #[source]
30 source: std::io::Error,
31 },
32
33 #[error("failed to copy the git index '{}': {source}", path.display())]
34 CopyIndex {
35 path: PathBuf,
36 #[source]
37 source: std::io::Error,
38 },
39
40 #[error("git workspace command failed: {0}")]
41 Git(#[from] GitError),
42
43 #[error("git workspace subdirectory does not exist: {}", path.display())]
44 MissingSubdir { path: PathBuf },
45
46 #[error("git bundle file does not exist: {}", path.display())]
47 MissingBundle { path: PathBuf },
48}
49
50#[derive(Debug, Error)]
51pub enum EvalRunError {
52 #[error("agent run failed: {0}")]
53 Agent(#[from] RunError),
54
55 #[error("workspace error: {0}")]
56 Workspace(#[from] WorkspaceError),
57}