appcore_update/error.rs
1// =============================================================================
2// #######
3// ### ### F: error.rs
4// ## ## ## ## P: AppCore-Runtime
5// ## ##
6// C: 2026/07/22 15:41:18 by dnettoRaw
7// ## ## ## ## U: 2026/07/23 13:45:20 by dnettoRaw
8// ########### S: 1.0.1-rc.8
9// =============================================================================
10
11use crate::UpdateFaultPoint;
12
13/// Update lifecycle failure.
14#[derive(Debug, thiserror::Error)]
15pub enum UpdateError {
16 /// Artifact metadata is invalid.
17 #[error("invalid artifact metadata: {0}")]
18 InvalidArtifact(String),
19 /// Artifact is incompatible with the current runtime or protocol.
20 #[error("incompatible artifact: {0}")]
21 Incompatible(String),
22 /// Provider failed to list or fetch an artifact.
23 #[error("update provider failed: {0}")]
24 Provider(String),
25 /// Artifact exceeded the configured byte bound.
26 #[error("artifact exceeds maximum size of {max_bytes} bytes")]
27 ArtifactTooLarge {
28 /// Configured maximum size.
29 max_bytes: usize,
30 },
31 /// Artifact bytes do not match the declared checksum.
32 #[error("artifact checksum mismatch")]
33 ChecksumMismatch,
34 /// Artifact authenticity could not be established.
35 #[error("artifact authenticity verification failed: {0}")]
36 Authenticity(String),
37 /// Artifact storage failed.
38 #[error("artifact store failed: {0}")]
39 Store(String),
40 /// Activation health verification failed.
41 #[error("activated artifact failed health verification: {0}")]
42 Health(String),
43 /// A controlled fault was injected for validation.
44 #[error("injected update fault at {0:?}")]
45 InjectedFault(UpdateFaultPoint),
46 /// Rollback failed after activation failed.
47 #[error("rollback failed after {cause}: {rollback}")]
48 RollbackFailed {
49 /// Original activation or health failure.
50 cause: String,
51 /// Rollback failure detail.
52 rollback: String,
53 },
54}
55
56/// Result returned by the update lifecycle.
57pub type UpdateResult<T> = Result<T, UpdateError>;