Skip to main content

canic_host/deployment_truth/receipt/authority/
error.rs

1use super::super::super::*;
2use thiserror::Error as ThisError;
3
4///
5/// AuthorityEvidenceError
6///
7#[derive(Debug, ThisError)]
8pub enum AuthorityEvidenceError {
9    #[error("authority evidence is missing required field: {field}")]
10    MissingRequiredField { field: &'static str },
11
12    #[error(
13        "authority evidence {component} has unsupported schema version: expected {expected}, found {found}"
14    )]
15    SchemaVersionMismatch {
16        component: &'static str,
17        expected: u32,
18        found: u32,
19    },
20
21    #[error(
22        "authority report does not match reconciliation plan: {field} differs (plan={plan_value}, report={report_value})"
23    )]
24    PlanReportMismatch {
25        field: &'static str,
26        plan_value: String,
27        report_value: String,
28    },
29
30    #[error("authority report content does not match reconciliation plan: {field} differs")]
31    PlanReportContentMismatch { field: &'static str },
32
33    #[error("authority dry-run receipt contains attempted controller actions: {count}")]
34    DryRunReceiptAttemptedActions { count: usize },
35
36    #[error("authority dry-run receipt has invalid operation status: {status:?}")]
37    DryRunReceiptStatus { status: DeploymentExecutionStatusV1 },
38
39    #[error("authority dry-run receipt has invalid command result: {result:?}")]
40    DryRunReceiptCommandResult { result: DeploymentCommandResultV1 },
41
42    #[error("authority dry-run receipt is complete but has no finished_at timestamp")]
43    DryRunReceiptMissingFinishedAt,
44
45    #[error(
46        "authority evidence generated_at does not match receipt finished_at (evidence={evidence_value}, receipt={receipt_value})"
47    )]
48    EvidenceGeneratedAtMismatch {
49        evidence_value: String,
50        receipt_value: String,
51    },
52
53    #[error(
54        "authority dry-run receipt has invalid timestamp order: {field} ({left}) is after {other_field} ({right})"
55    )]
56    DryRunReceiptTimestampOrder {
57        field: &'static str,
58        left: String,
59        other_field: &'static str,
60        right: String,
61    },
62
63    #[error(
64        "authority receipt check id does not match report check id (receipt={receipt_value}, report={report_value})"
65    )]
66    CheckIdMismatch {
67        receipt_value: String,
68        report_value: String,
69    },
70
71    #[error(
72        "authority evidence check id does not match nested {component} check id (evidence={evidence_value}, nested={nested_value})"
73    )]
74    EvidenceCheckIdMismatch {
75        component: &'static str,
76        evidence_value: String,
77        nested_value: String,
78    },
79}