Skip to main content

agent_migrate_adapters/
error.rs

1use std::path::PathBuf;
2
3use agent_migrate_core::{BundleError, BundlePathError, PathMappingError, SecretError};
4use thiserror::Error;
5
6#[derive(Debug, Error)]
7pub enum AdapterError {
8    #[error("project scope requires --workspace")]
9    WorkspaceRequired,
10    #[error("symlink escapes scan root: {logical_path}")]
11    SymlinkEscape { logical_path: String },
12    #[error("filesystem error at {path}")]
13    Io {
14        path: PathBuf,
15        #[source]
16        source: std::io::Error,
17    },
18    #[error("directory traversal failed: {0}")]
19    Walk(String),
20    #[error("structured config is invalid at {path}: {message}")]
21    Structured { path: PathBuf, message: String },
22    #[error("adapter invariant failed")]
23    InternalInvariant,
24    #[error("lossy conversion requires explicit acceptance: {path}")]
25    LossyAcceptanceRequired { path: String },
26    #[error("required bridge is unavailable: {path}")]
27    BridgeUnavailable { path: String },
28    #[error("compatibility blocks import: {path}")]
29    CompatibilityBlocked { path: String },
30    #[error("render failed for {path}: {message}")]
31    Render { path: String, message: String },
32    #[error(transparent)]
33    BundlePath(#[from] BundlePathError),
34    #[error(transparent)]
35    Bundle(#[from] BundleError),
36    #[error(transparent)]
37    Secret(#[from] SecretError),
38    #[error(transparent)]
39    PathMapping(#[from] PathMappingError),
40}