microsandbox_cli/
error.rs

1//--------------------------------------------------------------------------------------------------
2// Types
3//--------------------------------------------------------------------------------------------------
4
5use thiserror::Error;
6
7/// The result of a microsandbox-cli related operation.
8pub type MicrosandboxCliResult<T> = Result<T, MicrosandboxCliError>;
9
10/// An error that occurred during a file system operation.
11#[derive(pretty_error_debug::Debug, Error)]
12pub enum MicrosandboxCliError {
13    /// An I/O error.
14    #[error("io error: {0}")]
15    Io(#[from] std::io::Error),
16
17    /// Error returned from the microsandbox-server crate
18    #[error(transparent)]
19    Server(#[from] microsandbox_server::MicrosandboxServerError),
20
21    /// Error returned from the microsandbox-core crate
22    #[error(transparent)]
23    Core(#[from] microsandbox_core::MicrosandboxError),
24
25    /// Invalid argument
26    #[error("invalid argument: {0}")]
27    InvalidArgument(String),
28
29    /// Not found
30    #[error("not found: {0}")]
31    NotFound(String),
32
33    /// Process wait error
34    #[error("process wait error: {0}")]
35    ProcessWaitError(String),
36
37    /// Configuration error
38    #[error("configuration error: {0}")]
39    ConfigError(String),
40
41    /// Namespace operation error
42    #[error("namespace error: {0}")]
43    NamespaceError(String),
44}