Skip to main content

phoxal_bundle/
error.rs

1//! Bundle I/O failures.
2
3use std::path::PathBuf;
4
5use crate::BundlePathError;
6
7/// Why reading or writing a bundle failed.
8///
9/// Every variant is an I/O or layout fact. There is no "this bundle is not a
10/// valid execution plan" family any more: the manifest either parses into a
11/// validated [`phoxal_model::Robot`] or it does not, and the model owns that
12/// judgment.
13#[derive(Debug, thiserror::Error)]
14pub enum BundleError {
15    #[error("failed to resolve bundle root {}: {source}", path.display())]
16    Root {
17        path: PathBuf,
18        #[source]
19        source: std::io::Error,
20    },
21    #[error("bundle root is not a directory: {0}")]
22    NotDirectory(PathBuf),
23    #[error("bundle target already exists: {0}")]
24    TargetExists(PathBuf),
25    #[error("failed to read bundle manifest {}: {source}", path.display())]
26    ReadManifest {
27        path: PathBuf,
28        #[source]
29        source: std::io::Error,
30    },
31    #[error("bundle manifest is not a readable phoxal document: {0}")]
32    ManifestJson(#[from] serde_json::Error),
33    #[error("bundle contains unsupported filesystem entry {path}")]
34    UnsupportedEntry { path: PathBuf },
35    #[error("bundle executable is not executable: {path}")]
36    NotExecutable { path: PathBuf },
37    #[error("bundle is missing required file {path}")]
38    MissingFile { path: PathBuf },
39    #[error("failed to read bundle file {path}: {source}", path = path.display())]
40    ReadFile {
41        path: PathBuf,
42        #[source]
43        source: std::io::Error,
44    },
45    #[error(transparent)]
46    Path(#[from] BundlePathError),
47}