use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum RustBuilderError {
#[error("Cargo.toml not found starting from '{path}'")]
CargoTomlNotFound { path: PathBuf },
#[error("Failed to parse Cargo.toml at '{path}': {message}")]
CargoTomlParseError { path: PathBuf, message: String },
#[error("Build failed with exit code {code}: {stderr}")]
BuildFailed { code: i32, stderr: String },
#[error("Binary '{name}' not found in project")]
BinaryNotFound { name: String },
#[error("Artifact not found at expected path '{path}'")]
ArtifactNotFound { path: PathBuf },
#[error("Failed to copy artifact: {message}")]
CopyFailed { message: String },
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Path '{path}' does not exist")]
PathNotFound { path: PathBuf },
#[error("TOML error: {0}")]
TomlError(#[from] toml::de::Error),
#[error("Invalid configuration: {0}")]
InvalidConfig(String),
}
pub type BuilderResult<T> = Result<T, RustBuilderError>;