pub type Result<T> = std::result::Result<T, Error>;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("No fetchers found for blueprint")]
NoFetchers,
#[error("No testing fetcher found for blueprint, despite operating in test mode")]
NoTestFetcher,
#[error("Blueprint does not contain a supported fetcher")]
UnsupportedBlueprint,
#[error("Unable to find matching binary")]
NoMatchingBinary,
#[error("Binary hash {expected} mismatched expected hash of {actual}")]
HashMismatch { expected: String, actual: String },
#[error("Download failed from {url}: {reason}")]
DownloadFailed { url: String, reason: String },
#[error("Archive from {url} exceeded {max} bytes (actual {size})")]
ArchiveTooLarge { url: String, size: u64, max: u64 },
#[error("IPFS gateway URL must be configured via IPFS_GATEWAY_URL to download {url}")]
MissingIpfsGateway { url: String },
#[error("Failed to build binary: {0:?}")]
BuildBinary(std::process::Output),
#[error("Failed to fetch git root: {0:?}")]
FetchGitRoot(std::process::Output),
#[error("Failed to verify attestation for GitHub release")]
AttestationFailed,
#[error("No GitHub CLI found, is it installed?")]
NoGithubCli,
#[error("Bridge error: {0}")]
Bridge(#[from] blueprint_manager_bridge::error::Error),
#[cfg(feature = "vm-sandbox")]
#[error("Hypervisor error: {0}")]
Hypervisor(String),
#[cfg(feature = "vm-sandbox")]
#[error("Networking error: {0}")]
Net(#[from] rtnetlink::Error),
#[cfg(feature = "vm-sandbox")]
#[error("Capabilities error: {0}")]
Caps(#[from] capctl::Error),
#[cfg(feature = "vm-sandbox")]
#[error("nftables error: {0}")]
Nftables(#[from] nftables::helper::NftablesError),
#[cfg(feature = "containers")]
#[error("Kubernetes: {0}")]
Kube(#[from] kube::Error),
#[cfg(feature = "containers")]
#[error("Failed to determine the local IP: {0}")]
LocalIp(#[from] local_ip_address::Error),
#[error("TEE runtime is not available: {reason}")]
TeeRuntimeUnavailable { reason: String },
#[error("TEE runtime prerequisite missing: {prerequisite}. {hint}")]
TeePrerequisiteMissing { prerequisite: String, hint: String },
#[error("Failed to get initial block hash")]
InitialBlock,
#[error("Finality Notification stream died")]
ClientDied,
#[error("{0}")]
Other(String),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error(transparent)]
#[cfg(feature = "vm-sandbox")]
Errno(#[from] nix::errno::Errno),
#[error(transparent)]
WalkDir(#[from] walkdir::Error),
#[error(transparent)]
Utf8(#[from] std::string::FromUtf8Error),
#[error(transparent)]
Serialization(#[from] serde_json::Error),
#[error(transparent)]
Request(#[from] reqwest::Error),
#[error(transparent)]
TangleClient(#[from] blueprint_client_tangle::Error),
#[error(transparent)]
Auth(#[from] blueprint_auth::Error),
#[error(transparent)]
Keystore(#[from] blueprint_keystore::Error),
#[cfg(feature = "remote-providers")]
#[error(transparent)]
RemoteProvider(#[from] blueprint_remote_providers::Error),
}