use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum ConfigError {
#[error("missing required field [{section}] {field}")]
MissingField {
section: &'static str,
field: &'static str,
},
#[error("unsupported schema_version {got} (this build supports version {expected})")]
UnsupportedVersion { got: u32, expected: u32 },
#[error("invalid glob pattern {pattern:?}: {reason}")]
InvalidGlob { pattern: String, reason: String },
#[error("cannot read sync profile {path:?}: {source}")]
Read {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("cannot write sync profile {path:?}: {source}")]
Write {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("cannot parse sync profile {path:?}: {reason}")]
Parse { path: PathBuf, reason: String },
#[error("sync profile {name:?} not found; check the profiles dir with `dapctl profile list`")]
NotFound { name: String },
}
#[derive(Debug, thiserror::Error)]
pub enum DapError {
#[error(
"unknown DAP profile {id:?}; \
run `dapctl profile list` to see available profiles"
)]
UnknownId { id: String },
#[error("failed to parse builtin DAP profile {id:?}: {reason}")]
ParseBuiltin { id: String, reason: String },
#[error("cannot read DAP profile override {path:?}: {source}")]
ReadOverride {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("invalid DAP profile override {path:?}: {reason}")]
InvalidOverride { path: PathBuf, reason: String },
}
#[derive(Debug, thiserror::Error)]
pub enum ScanError {
#[error(
"no connected drive identified as DAP {dap_id:?}; \
run `dapctl scan` to see connected drives"
)]
DestinationNotFound { dap_id: String },
}