auths_verifier/org_bundle/
error.rs1use auths_crypto::AuthsErrorInfo;
4
5#[derive(Debug, thiserror::Error)]
10#[non_exhaustive]
11pub enum OrgBundleError {
12 #[error("bundle integrity failure for '{id}': {reason}")]
17 Integrity {
18 id: String,
20 reason: String,
22 },
23
24 #[error("bundle is missing the KEL for delegated member '{member}'")]
27 MissingMemberKel {
28 member: String,
30 },
31
32 #[error("member '{member}' has no delegation seal in the org KEL")]
35 MissingDelegatorSeal {
36 member: String,
38 },
39
40 #[error("canonicalization failed: {0}")]
42 Canonicalize(String),
43
44 #[error("parse failed: {0}")]
46 Parse(String),
47
48 #[error("offboarding record invalid: {0}")]
52 RecordInvalid(String),
53}
54
55impl AuthsErrorInfo for OrgBundleError {
56 fn error_code(&self) -> &'static str {
57 match self {
58 Self::Integrity { .. } => "AUTHS-E2201",
59 Self::MissingMemberKel { .. } => "AUTHS-E2202",
60 Self::MissingDelegatorSeal { .. } => "AUTHS-E2203",
61 Self::Canonicalize(_) => "AUTHS-E2204",
62 Self::Parse(_) => "AUTHS-E2205",
63 Self::RecordInvalid(_) => "AUTHS-E2206",
64 }
65 }
66
67 fn suggestion(&self) -> Option<&'static str> {
68 match self {
69 Self::Integrity { .. } => Some(
70 "The bundle was modified after it was produced; obtain a fresh, untampered bundle",
71 ),
72 Self::MissingMemberKel { .. } | Self::MissingDelegatorSeal { .. } => {
73 Some("The bundle is incomplete; re-produce it with `auths org bundle`")
74 }
75 Self::Canonicalize(_) | Self::Parse(_) => {
76 Some("The file is not a valid air-gapped org bundle; re-export it")
77 }
78 Self::RecordInvalid(_) => Some(
79 "The off-boarding record does not match the org KEL; obtain a fresh bundle from the org",
80 ),
81 }
82 }
83}