lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

error.rs (4209B)


      1 use std::path::PathBuf;
      2 
      3 use radroots_runtime_paths::{RadrootsRuntimePathSelectionError, RadrootsRuntimePathsError};
      4 use thiserror::Error;
      5 
      6 #[derive(Debug, Error)]
      7 pub enum RadrootsRuntimeManagerError {
      8     #[error("parse runtime management contract: {0}")]
      9     Parse(String),
     10     #[error("runtime management schema `{found}` does not match `{expected}`")]
     11     UnexpectedSchema {
     12         expected: &'static str,
     13         found: String,
     14     },
     15     #[error("management mode `{0}` not found in runtime management contract")]
     16     UnknownManagementMode(String),
     17     #[error("management mode `{mode_id}` does not support profile `{profile}`")]
     18     UnsupportedProfile { mode_id: String, profile: String },
     19     #[error("management mode `{0}` has no shared path specification")]
     20     MissingPathSpec(String),
     21     #[error("unknown root class `{0}` in runtime management contract")]
     22     UnknownRootClass(String),
     23     #[error("runtime `{0}` has no bootstrap entry in runtime management contract")]
     24     UnknownBootstrapRuntime(String),
     25     #[error("read runtime instance registry {path}: {source}")]
     26     ReadRegistry {
     27         path: PathBuf,
     28         source: std::io::Error,
     29     },
     30     #[error("parse runtime instance registry {path}: {details}")]
     31     ParseRegistry { path: PathBuf, details: String },
     32     #[error("serialize runtime instance registry: {0}")]
     33     SerializeRegistry(String),
     34     #[error("create runtime instance registry parent {path}: {source}")]
     35     CreateRegistryParent {
     36         path: PathBuf,
     37         source: std::io::Error,
     38     },
     39     #[error("write runtime instance registry {path}: {source}")]
     40     WriteRegistry {
     41         path: PathBuf,
     42         source: std::io::Error,
     43     },
     44     #[error("create directory {path}: {source}")]
     45     CreateDirectory {
     46         path: PathBuf,
     47         source: std::io::Error,
     48     },
     49     #[error("copy runtime binary from {from} to {to}: {source}")]
     50     CopyBinary {
     51         from: PathBuf,
     52         to: PathBuf,
     53         source: std::io::Error,
     54     },
     55     #[error("serialize runtime instance metadata: {0}")]
     56     SerializeInstanceMetadata(String),
     57     #[error("write runtime instance metadata {path}: {source}")]
     58     WriteInstanceMetadata {
     59         path: PathBuf,
     60         source: std::io::Error,
     61     },
     62     #[error("write managed file {path}: {source}")]
     63     WriteManagedFile {
     64         path: PathBuf,
     65         source: std::io::Error,
     66     },
     67     #[error("read managed file {path}: {source}")]
     68     ReadManagedFile {
     69         path: PathBuf,
     70         source: std::io::Error,
     71     },
     72     #[error("open runtime log file {path}: {source}")]
     73     OpenLogFile {
     74         path: PathBuf,
     75         source: std::io::Error,
     76     },
     77     #[error("spawn managed runtime process {binary_path}: {source}")]
     78     SpawnProcess {
     79         binary_path: PathBuf,
     80         source: std::io::Error,
     81     },
     82     #[error("write pid file {path}: {source}")]
     83     WritePidFile {
     84         path: PathBuf,
     85         source: std::io::Error,
     86     },
     87     #[error("read pid file {path}: {source}")]
     88     ReadPidFile {
     89         path: PathBuf,
     90         source: std::io::Error,
     91     },
     92     #[error("parse pid file {path}: invalid contents `{contents}`")]
     93     ParsePidFile { path: PathBuf, contents: String },
     94     #[error("remove managed path {path}: {source}")]
     95     RemovePath {
     96         path: PathBuf,
     97         source: std::io::Error,
     98     },
     99     #[error("set file permissions for {path}: {source}")]
    100     SetPermissions {
    101         path: PathBuf,
    102         source: std::io::Error,
    103     },
    104     #[error("signal pid {pid} with {signal}: {source}")]
    105     ExecuteProcessSignal {
    106         pid: u32,
    107         signal: String,
    108         source: std::io::Error,
    109     },
    110     #[error("stop pid {pid}: {details}")]
    111     StopProcess { pid: u32, details: String },
    112     #[error("unsupported archive format `{archive_format}` for {archive_path}")]
    113     UnsupportedArchiveFormat {
    114         archive_path: PathBuf,
    115         archive_format: String,
    116     },
    117     #[error("unpack archive {archive_path}: {source}")]
    118     UnpackArchive {
    119         archive_path: PathBuf,
    120         source: std::io::Error,
    121     },
    122     #[error(transparent)]
    123     RuntimePaths(#[from] RadrootsRuntimePathsError),
    124     #[error(transparent)]
    125     RuntimePathSelection(#[from] RadrootsRuntimePathSelectionError),
    126 }