Skip to main content

hoike_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum CoreError {
5    #[error("empty OCSP request")]
6    EmptyRequest,
7
8    #[error("request too large: {size} bytes (max {max})")]
9    RequestTooLarge { size: usize, max: usize },
10
11    #[error("empty request list in OCSPRequest")]
12    EmptyRequestList,
13
14    #[error("DER parse error in {context}: {detail}")]
15    DerParse {
16        context: &'static str,
17        detail: String,
18    },
19
20    #[error("GET path decode error: {0}")]
21    GetDecode(String),
22
23    #[error("no matching CA scope for CertID")]
24    NoMatchingScope,
25
26    #[error("bundle error: {0}")]
27    Bundle(#[from] ahu::AhuError),
28
29    #[error("configuration error: {0}")]
30    Config(String),
31
32    #[error("epoch rollback: scope {scope} epoch {epoch} <= high-water {high_water}")]
33    EpochRollback {
34        scope: String,
35        epoch: u64,
36        high_water: u64,
37    },
38
39    #[error(
40        "epoch jump too large: scope {scope} epoch {epoch} jumps {jump} from high-water {high_water} (max allowed: {max_jump})"
41    )]
42    EpochJumpTooLarge {
43        scope: String,
44        epoch: u64,
45        high_water: u64,
46        jump: u64,
47        max_jump: u64,
48    },
49
50    #[error("fork detected: prev_manifest_digest mismatch for scope {scope}")]
51    ForkDetected { scope: String },
52
53    #[error("state store error: {0}")]
54    StateStore(String),
55
56    #[error("I/O error: {0}")]
57    Io(#[from] std::io::Error),
58}
59
60pub type Result<T> = std::result::Result<T, CoreError>;