airbender_build/
errors.rs1use airbender_core::host::manifest::ManifestError;
4use std::process::ExitStatus;
5
6#[derive(Debug, thiserror::Error)]
8pub enum BuildError {
9 #[error("io error: {0}")]
11 Io(#[from] std::io::Error),
12
13 #[error("command `{cmd}` failed with status {status}")]
15 ProcessFailed { cmd: String, status: ExitStatus },
16
17 #[error("missing field: {0}")]
19 MissingField(&'static str),
20
21 #[error("invalid config: {0}")]
23 InvalidConfig(String),
24
25 #[error("docker not found: install Docker and ensure it is on PATH")]
27 DockerNotFound,
28
29 #[error("docker daemon is not running: start Docker Desktop or the docker service")]
31 DockerNotRunning,
32
33 #[error("failed to build Docker image for reproducible build")]
35 DockerBuildFailed,
36
37 #[error(
39 "Cargo.lock not found in `{project}` or not generated with the container toolchain ({toolchain})\n\
40 fix: cargo +{toolchain} generate-lockfile --manifest-path {project}/Cargo.toml"
41 )]
42 LockfileNotReady {
43 project: String,
44 toolchain: &'static str,
45 },
46}
47
48impl From<ManifestError> for BuildError {
49 fn from(err: ManifestError) -> Self {
50 match err {
51 ManifestError::Io(err) => Self::Io(err),
52 _ => Self::InvalidConfig(err.to_string()),
53 }
54 }
55}
56
57pub type Result<T> = std::result::Result<T, BuildError>;