1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Error types for the microsandbox-agentd crate.
use thiserror::Error;
//--------------------------------------------------------------------------------------------------
// Types
//--------------------------------------------------------------------------------------------------
/// The result type for agentd operations.
pub type AgentdResult<T> = Result<T, AgentdError>;
/// Errors that can occur during agent daemon operations.
#[derive(Debug, Error)]
pub enum AgentdError {
/// An I/O error.
#[error("io error: {0}")]
Io(#[from] std::io::Error),
/// A protocol error.
#[error("protocol error: {0}")]
Protocol(#[from] microsandbox_protocol::ProtocolError),
/// A nix/libc error.
#[error("nix error: {0}")]
Nix(#[from] nix::Error),
/// A JSON serialization error.
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
/// Failed to find the virtio serial port.
#[error("serial port not found: {0}")]
SerialPortNotFound(String),
/// An exec session error.
#[error("exec session error: {0}")]
ExecSession(String),
/// The configured guest user name could not be resolved.
#[error("exec session error: guest user not found: {0}")]
UserNotFound(String),
/// The configured guest group name could not be resolved.
#[error("exec session error: guest group not found: {0}")]
GroupNotFound(String),
/// A spawn-time exec failure with classified payload, ready to
/// be shipped to the host as `ExecFailed`. Distinct from
/// `ExecSession` (which is a free-form internal error) — this
/// variant carries typed information the host can act on.
#[error("exec spawn failed: {}", .0.message)]
ExecSpawnFailed(microsandbox_protocol::exec::ExecFailed),
/// A config parse error at startup (malformed `MSB_*` env var).
#[error("config error: {0}")]
Config(String),
/// An init error.
#[error("init error: {0}")]
Init(String),
/// Graceful shutdown requested.
#[error("shutdown")]
Shutdown,
}