qualia_core_db/q42/asset_envelope/
error.rs1use std::fmt;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub enum AssetEnvelopeError {
7 UnknownLicence,
8 MissingTermsUrl,
9 MissingAssetId,
10 MissingUpstreamRelease,
11 DigestMismatch,
12 InvalidMagic,
13 UnsupportedVersion,
14 Truncated,
15 Oversize,
16 InvalidUtf8,
17 InvalidSensitivity,
18 InvalidRoutingLane,
19 ChunkBudgetExceeded,
20 CountInconsistency,
21 EmptyChunkPlan,
22}
23
24impl fmt::Display for AssetEnvelopeError {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 match self {
27 Self::UnknownLicence => write!(f, "unknown licence fails closed"),
28 Self::MissingTermsUrl => write!(f, "licence terms URL is required"),
29 Self::MissingAssetId => write!(f, "asset id is required"),
30 Self::MissingUpstreamRelease => write!(f, "upstream release identity is required"),
31 Self::DigestMismatch => write!(f, "payload digest does not match envelope"),
32 Self::InvalidMagic => write!(f, "invalid Q42 asset envelope magic"),
33 Self::UnsupportedVersion => write!(f, "unsupported Q42 asset envelope version"),
34 Self::Truncated => write!(f, "truncated Q42 asset envelope"),
35 Self::Oversize => write!(f, "Q42 asset envelope exceeds size budget"),
36 Self::InvalidUtf8 => write!(f, "invalid UTF-8 in Q42 asset envelope"),
37 Self::InvalidSensitivity => write!(f, "invalid sensitivity class"),
38 Self::InvalidRoutingLane => write!(f, "invalid commons routing lane"),
39 Self::ChunkBudgetExceeded => {
40 write!(f, "chunk plan exceeds the 42 MiB Sentinel pass budget")
41 }
42 Self::CountInconsistency => {
43 write!(f, "accepted + quarantined counts exceed source count")
44 }
45 Self::EmptyChunkPlan => write!(f, "chunk plan is required for a release envelope"),
46 }
47 }
48}
49
50impl std::error::Error for AssetEnvelopeError {}