Skip to main content

arcbox_migration/
error.rs

1//! Error types for migration planning and execution.
2
3use std::path::PathBuf;
4
5/// Result alias for migration operations.
6pub type Result<T> = std::result::Result<T, MigrationError>;
7
8/// Migration failures.
9#[derive(Debug, thiserror::Error)]
10pub enum MigrationError {
11    /// The source runtime could not be located.
12    #[error("migration source '{kind}' is unavailable at {path}")]
13    MissingSource {
14        /// Source kind.
15        kind: &'static str,
16        /// Expected socket path.
17        path: PathBuf,
18    },
19    /// The source runtime is not supported by v1.
20    #[error("unsupported migration source: {0}")]
21    UnsupportedSource(String),
22    /// The discovered object is out of scope for v1.
23    #[error("unsupported resource for v1 migration: {0}")]
24    UnsupportedResource(String),
25    /// The current state blocks migration until the user confirms or changes it.
26    #[error("migration is blocked: {0}")]
27    Blocked(String),
28    /// The migration plan is internally inconsistent.
29    #[error("invalid migration plan: {0}")]
30    InvalidPlan(String),
31    /// The remote Docker API returned an error.
32    #[error("docker API error: {0}")]
33    Docker(String),
34    /// A filesystem operation failed.
35    #[error(transparent)]
36    Io(#[from] std::io::Error),
37    /// JSON encoding or decoding failed.
38    #[error(transparent)]
39    SerdeJson(#[from] serde_json::Error),
40}