herolib_code/rust_builder/
error.rs1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
6pub enum RustBuilderError {
7 #[error("Cargo.toml not found starting from '{path}'")]
9 CargoTomlNotFound { path: PathBuf },
10
11 #[error("Failed to parse Cargo.toml at '{path}': {message}")]
13 CargoTomlParseError { path: PathBuf, message: String },
14
15 #[error("Build failed with exit code {code}: {stderr}")]
17 BuildFailed { code: i32, stderr: String },
18
19 #[error("Binary '{name}' not found in project")]
21 BinaryNotFound { name: String },
22
23 #[error("Artifact not found at expected path '{path}'")]
25 ArtifactNotFound { path: PathBuf },
26
27 #[error("Failed to copy artifact: {message}")]
29 CopyFailed { message: String },
30
31 #[error("IO error: {0}")]
33 Io(#[from] std::io::Error),
34
35 #[error("Path '{path}' does not exist")]
37 PathNotFound { path: PathBuf },
38
39 #[error("TOML error: {0}")]
41 TomlError(#[from] toml::de::Error),
42
43 #[error("Invalid configuration: {0}")]
45 InvalidConfig(String),
46}
47
48pub type BuilderResult<T> = Result<T, RustBuilderError>;