canic_host/frontend/
mod.rs1pub mod model;
6pub mod ops;
7pub mod policy;
8#[cfg(test)]
9mod tests;
10pub mod view;
11pub mod workflow;
12
13use thiserror::Error;
14
15#[derive(Debug, Error)]
17pub enum FrontendError {
18 #[error("uploaded frontend asset differs from the handoff: {key}")]
19 AssetMismatch { key: String },
20
21 #[error("asset prefix must be an absolute path with ordinary nonempty segments")]
22 AssetPrefix,
23
24 #[error("asset query failed: {0}")]
25 AssetQuery(#[source] Box<ic_agent::AgentError>),
26
27 #[error("asset query returned an invalid or oversized Candid response")]
28 AssetResponse,
29
30 #[error("asset verification exceeded its query deadline")]
31 AssetTimeout,
32
33 #[error(transparent)]
34 Management(#[from] Box<crate::icp::IcpManagementCallError>),
35
36 #[error("frontend derivation origin differs from the reviewed Fleet admission namespace")]
37 AdmissionOrigin,
38
39 #[error("frontend artifact exceeds the configured {0} bound")]
40 Bound(&'static str),
41
42 #[error("invalid frontend Candid: {0}")]
43 Candid(String),
44
45 #[error("frontend environment or network differs from the terminal Fleet")]
46 Environment,
47
48 #[error("frontend bundle digest or artifact identity differs from the expected handoff")]
49 Integrity,
50
51 #[error(transparent)]
52 Icp(#[from] crate::icp::IcpCommandError),
53
54 #[error(transparent)]
55 Inventory(#[from] crate::fleet_ensure::CurrentFleetInventoryError),
56
57 #[error(transparent)]
58 Io(#[from] std::io::Error),
59
60 #[error(transparent)]
61 Json(#[from] serde_json::Error),
62
63 #[error(transparent)]
64 Network(#[from] crate::network::NetworkIdentityError),
65
66 #[error("external asset canister has no exact native cycle balance in its management status")]
67 NativeBalance,
68
69 #[error(
70 "external asset native cycles {available} are below the reviewed floor {required}; top up the canister's native balance before upload"
71 )]
72 NativeCapacity { available: u128, required: u128 },
73
74 #[error(
75 "frontend origin must be canonical HTTPS, or explicit loopback HTTP for local use: {0}"
76 )]
77 Origin(String),
78
79 #[error("frontend origins must be unique and authorize the selected asset origin")]
80 OriginSet,
81
82 #[error("frontend canister Principal must identify a concrete canister")]
83 Principal,
84
85 #[error(transparent)]
86 ProtocolBinding(#[from] crate::protocol_binding::ProtocolBindingError),
87
88 #[error("frontend selection has no unique terminal role binding: {0}")]
89 Role(String),
90
91 #[error("unsupported frontend schema version")]
92 Schema,
93
94 #[error(transparent)]
95 State(#[from] crate::fleet_ensure::ops::EnsureStateError),
96}