1use std::io;
2use std::path::PathBuf;
3
4#[derive(thiserror::Error, Debug)]
5pub enum PodboxError {
6 #[error("container '{0}' not found -- run `podbox build` and `podbox enable` first")]
7 ContainerMissing(String),
8
9 #[error("definition file not found at {path}")]
10 DefinitionNotFound { path: PathBuf },
11
12 #[error("failed to read definition file: {0}")]
13 DefinitionReadFailed(#[from] io::Error),
14
15 #[error("failed to parse definition file: {0}")]
16 DefinitionParseFailed(#[from] toml::de::Error),
17
18 #[error("podman not found in PATH")]
19 PodmanNotFound,
20
21 #[error("home directory '{path}' could not be created: {source}")]
22 HomeCreateFailed { path: PathBuf, source: io::Error },
23
24 #[error("podman inspect failed for '{name}': {stderr}")]
25 PodmanInspectFailed { name: String, stderr: String },
26
27 #[error("build failed: {0}")]
28 BuildFailed(String),
29
30 #[error("export failed: {details}")]
31 ExportFailed { details: String },
32
33 #[error("xdg-user-dir not found in PATH -- install xdg-user-dirs")]
34 XdgUserDirNotFound,
35
36 #[error("failed to pull image '{image}'")]
37 PullFailed { image: String },
38
39 #[error("failed to tag image as '{image}'")]
40 TagFailed { image: String },
41
42 #[error("protocol version mismatch: host speaks v{expected}, guest speaks v{got}")]
43 ProtocolMismatch { expected: u32, got: u32 },
44
45 #[error("config validation failed:\n{details}")]
46 ConfigValidationFailed { details: String },
47
48 #[error(
49 "this build of podbox has no embedded guest binary and can only manage prebuilt images -- use a release binary or a source build with the podbox-guest workspace present to build custom images"
50 )]
51 GuestBinaryUnavailable,
52}