1use thiserror::Error;
2
3pub type VmRuntimeResult<T> = Result<T, VmRuntimeError>;
5
6#[derive(Debug, Error)]
8pub enum VmRuntimeError {
9 #[error("vm '{0}' already exists")]
11 VmAlreadyExists(String),
12
13 #[error("vm '{0}' not found")]
15 VmNotFound(String),
16
17 #[error("invalid vm transition for '{vm_id}': {from} -> {to}")]
19 InvalidTransition {
20 vm_id: String,
21 from: String,
22 to: &'static str,
23 },
24
25 #[error("snapshot '{snapshot_id}' already exists for vm '{vm_id}'")]
27 SnapshotAlreadyExists { vm_id: String, snapshot_id: String },
28
29 #[error("provider state lock poisoned")]
31 StatePoisoned,
32
33 #[error("backend unsupported: {0}")]
35 Unsupported(String),
36}