aura_anim_core/runtime/error.rs
1//! Errors returned by typed motion handles and runtime operations.
2
3/// Failure while accessing or modifying a runtime-managed motion.
4#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
5pub enum MotionError {
6 /// The handle references a slot that does not exist.
7 #[error("motion slot {slot} is outside the runtime storage")]
8 SlotOutOfBounds {
9 /// Referenced slot index.
10 slot: usize,
11 },
12 /// The slot has been reused since this handle was created.
13 #[error(
14 "motion slot {slot} has generation {actual_generation}, but the handle expects {handle_generation}"
15 )]
16 StaleHandle {
17 /// Referenced slot index.
18 slot: usize,
19 /// Generation stored in the handle.
20 handle_generation: u64,
21 /// Current generation stored in the runtime.
22 actual_generation: u64,
23 },
24 /// The animation was removed from its slot.
25 #[error("motion slot {slot} no longer contains an animation")]
26 Removed {
27 /// Referenced slot index.
28 slot: usize,
29 },
30 /// The handle's value type does not match the animation in the slot.
31 #[error("motion value type mismatch: expected {expected}, found {actual}")]
32 TypeMismatch {
33 /// Type requested through the handle.
34 expected: &'static str,
35 /// Type currently stored in the slot.
36 actual: &'static str,
37 },
38}