use thiserror::Error;
#[derive(Debug, Error)]
pub enum ToolchainError {
#[error("Registry error: {message}")]
RegistryError {
message: String,
},
#[error("Cache error: {message}")]
CacheError {
message: String,
},
#[error("digest mismatch for {tool}: expected {expected}, got {actual}")]
DigestMismatch {
tool: String,
expected: String,
actual: String,
},
#[error("no container build executor registered; cannot build toolchain '{tool}' in isolation (register one via zlayer_toolchain::executor::set_container_executor)")]
ExecutorUnavailable {
tool: String,
},
#[error("recipe for toolchain '{tool}' uses unsupported constructs: {}", constructs.join(", "))]
RecipeUnsupported {
tool: String,
constructs: Vec<String>,
},
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
}
pub type Result<T, E = ToolchainError> = std::result::Result<T, E>;