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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! error — auto-split from the parent module by `split-by-grouping`.
#![allow(missing_docs)]
#[allow(unused_imports)]
use crate::pod;
#[allow(unused_imports)]
use firkin_types::{InvalidContainerId, InvalidProcessId};
#[allow(unused_imports)]
use thiserror::Error as ThisError;
/// Crate-local result type.
pub type Result<T> = std::result::Result<T, Error>;
/// Core container-surface errors.
#[derive(Debug, PartialEq, Eq, ThisError)]
pub enum Error {
/// The container ID failed validation.
#[error(transparent)]
InvalidContainerId(#[from] InvalidContainerId),
/// The process ID failed validation.
#[error(transparent)]
InvalidProcessId(#[from] InvalidProcessId),
/// Runtime orchestration is not implemented in this slice yet.
#[error("container runtime orchestration is not implemented")]
RuntimeNotImplemented,
/// A command argument cannot be represented in the OCI runtime spec.
#[error("command argument at index {index} is not valid UTF-8")]
InvalidCommandArgument {
/// Argument index.
index: usize,
},
/// An environment variable cannot be represented in the OCI runtime spec.
#[error("environment variable at index {index} is not valid UTF-8")]
InvalidEnvironmentVariable {
/// Environment variable index.
index: usize,
},
/// The working directory cannot be represented in the OCI runtime spec.
#[error("working directory is not valid UTF-8")]
InvalidWorkingDirectory,
/// A guest path is invalid for use as a Firkin-managed path.
#[error("invalid guest path `{path}`: {reason}")]
InvalidGuestPath {
/// Rejected guest path.
path: String,
/// Specific validation reason.
reason: &'static str,
},
/// A pod specification failed validation before runtime work began.
#[error(transparent)]
PodValidation(#[from] pod::PodValidationError),
/// Rootfs staging failed before VM boot.
#[error("rootfs assembly failed while {operation}: {reason}")]
RootfsAssembly {
/// Operation being attempted.
operation: &'static str,
/// Lower-level error detail.
reason: String,
},
/// Runtime artifact preparation failed before VM boot.
#[error("runtime artifact preparation failed while {operation}: {reason}")]
RuntimeArtifact {
/// Operation being attempted.
operation: &'static str,
/// Lower-level error detail.
reason: String,
},
/// Runtime orchestration failed after VM boot.
#[error("runtime operation failed while {operation}: {reason}")]
RuntimeOperation {
/// Operation being attempted.
operation: &'static str,
/// Lower-level error detail.
reason: String,
},
/// The configured writable layer is not backed by a block filesystem.
#[error("writable_layer must be a block device (got {kind})")]
InvalidWritableLayer {
/// Mount type that was rejected.
kind: String,
},
/// The configured raw seccomp policy is not valid JSON.
#[error("invalid seccomp policy: {reason}")]
InvalidSeccomp {
/// Lower-level error detail.
reason: String,
},
}