dsfb_densor_runtime/
errors.rs1use std::fmt;
5
6#[derive(Debug, Clone, PartialEq, Eq)]
8pub enum DensorError {
9 EmptyId,
11 EvidenceMismatch,
13}
14
15impl fmt::Display for DensorError {
16 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17 match self {
18 DensorError::EmptyId => write!(f, "densor has an empty densor_id"),
19 DensorError::EvidenceMismatch => {
20 write!(f, "densor evidence_hash does not match its recomputed seal")
21 }
22 }
23 }
24}
25impl std::error::Error for DensorError {}
26
27#[derive(Debug, Clone, PartialEq, Eq)]
31pub enum RuntimeError {
32 MissingAuthority { stage: String },
34 AuthorityMismatch { stage: String, authority: String },
36 ManifestInvalid(String),
38 StageFailed { stage: String, reason: String },
40}
41
42impl fmt::Display for RuntimeError {
43 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44 match self {
45 RuntimeError::MissingAuthority { stage } => {
46 write!(f, "stage '{stage}' declared no authority hashes (no claim without an authority anchor)")
47 }
48 RuntimeError::AuthorityMismatch { stage, authority } => {
49 write!(f, "stage '{stage}' authority '{authority}' is not in the manifest's frozen authority set")
50 }
51 RuntimeError::ManifestInvalid(why) => write!(f, "densor manifest invalid: {why}"),
52 RuntimeError::StageFailed { stage, reason } => {
53 write!(f, "stage '{stage}' failed: {reason}")
54 }
55 }
56 }
57}
58impl std::error::Error for RuntimeError {}