Skip to main content

canic_host/deployment_truth/root/
error.rs

1use thiserror::Error as ThisError;
2
3///
4/// DeploymentRootVerificationReportError
5///
6#[derive(Debug, Eq, PartialEq, ThisError)]
7pub enum DeploymentRootVerificationReportError {
8    #[error(
9        "deployment root verification report schema version {actual} does not match expected {expected}"
10    )]
11    SchemaVersionMismatch { expected: u32, actual: u32 },
12
13    #[error("deployment root verification report field `{field}` is required")]
14    MissingRequiredField { field: &'static str },
15
16    #[error("deployment root verification report field `{field}` must be lowercase SHA-256 hex")]
17    InvalidSha256Digest { field: &'static str },
18
19    #[error("deployment root verification report field `{field}` digest is stale")]
20    DigestMismatch { field: &'static str },
21
22    #[error("deployment root verification report check `{check}` is inconsistent")]
23    CheckMismatch { check: String },
24
25    #[error("deployment root verification report status is inconsistent")]
26    StatusMismatch,
27}
28
29///
30/// DeploymentRootVerificationReceiptError
31///
32#[derive(Debug, Eq, PartialEq, ThisError)]
33pub enum DeploymentRootVerificationReceiptError {
34    #[error(
35        "deployment root verification receipt schema version {actual} does not match expected {expected}"
36    )]
37    SchemaVersionMismatch { expected: u32, actual: u32 },
38
39    #[error("deployment root verification receipt field `{field}` is required")]
40    MissingRequiredField { field: &'static str },
41
42    #[error("deployment root verification receipt field `{field}` must be lowercase SHA-256 hex")]
43    InvalidSha256Digest { field: &'static str },
44
45    #[error(
46        "deployment root verification receipt field `{field}` must be a supported timestamp label"
47    )]
48    InvalidTimestampLabel { field: &'static str },
49
50    #[error("deployment root verification receipt field `{field}` digest is stale")]
51    DigestMismatch { field: &'static str },
52
53    #[error("deployment root verification receipt state transition is inconsistent")]
54    StateTransitionMismatch,
55
56    #[error("deployment root verification receipt local state digests are inconsistent")]
57    LocalStateDigestMismatch,
58
59    #[error("deployment root verification receipt source evidence is inconsistent")]
60    SourceEvidenceMismatch,
61}