1use javm_cap::{CacheError, CapError, OpError};
4
5#[derive(Debug, thiserror::Error)]
8pub enum VmError {
9 #[error("call stack full (max depth reached)")]
10 CallStackFull,
11 #[error("call stack empty")]
12 CallStackEmpty,
13 #[error("invariant violated: {0}")]
14 Invariant(&'static str),
15 #[error("reference entry targets out-of-range position {0}")]
16 ReferenceOutOfRange(usize),
17 #[error("reference entry targets a non-instance entry at position {0}")]
18 ReferenceNonInstance(usize),
19 #[error("instance lookup failed (no live state for the named instance hash)")]
20 InstanceNotFound,
21 #[error("image lookup failed for content hash")]
22 ImageNotFound,
23 #[error("cap-table operation failed: {0}")]
24 CapTable(#[from] CapError),
25 #[error("MGMT op failed: {0}")]
26 Op(#[from] OpError),
27 #[error("cache operation failed: {0}")]
28 CacheDirectory(#[from] CacheError),
29 #[error("yield marker did not match any handler on the call stack")]
30 UnhandledMarker,
31 #[error("image bytecode failed to parse: {0}")]
32 InvalidBytecode(String),
33 #[error("slot path step {0} expected a Cap::CNode but found a different kind")]
34 SlotKindMismatch(u32),
35 #[error("slot path step {0} traversed an empty slot")]
36 SlotEmpty(u32),
37 #[error("memory mapping setup failed: {0:?}")]
38 MapRegion(javm_exec::MapError),
39}