use thiserror::Error;
#[derive(Error, Debug)]
pub enum ManagerInitError {
#[error("The config directory could not be determined")]
NoConfigDirectory,
}
#[derive(Error, Debug)]
pub enum PreflightCheckError {
#[error("A required command could not be executed")]
CommandExecution(std::process::Command, std::io::Error),
#[error("A required command was executed, but was unsuccessful")]
CommandUnsuccessful(std::process::Command, std::process::Output),
#[error(
"The default mount path (/mnt/sshfs) could not be prepared. Mounting there will fail until this is fixed"
)]
DefaultBasePathIO(std::path::PathBuf, std::io::Error),
#[error(
"A test directory under the default mount path (/mnt/sshfs) could not be prepared. Mounting there will fail until this is fixed"
)]
TestUnderBasePathIO(std::path::PathBuf, std::io::Error),
}
#[derive(Error, Debug)]
pub enum SftpManError {
#[error("Generic error")]
Generic(String),
#[error("The mounts configuration directory does not exist")]
NoMountsConfigDirectory,
#[error("The current mounts could not be parsed")]
MountListParse(#[from] mnt::ParseError),
#[error("The mount config definition could not be read")]
FilesystemMountDefinitionRead(std::path::PathBuf, std::io::Error),
#[error("The mount config definition could not be removed")]
FilesystemMountDefinitionRemove(std::path::PathBuf, std::io::Error),
#[error("The mount config definition could not be parsed")]
JSON(std::path::PathBuf, serde_json::Error),
#[error("The mount path was found, but it was not of the expected type")]
MountVfsTypeMismatch {
path: std::path::PathBuf,
found_vfs_type: String,
expected_vfs_type: String,
},
#[error("The mount command could not be constructed")]
MountCommandBuilding(String),
#[error("The mount command could not be executed")]
CommandExecution(std::process::Command, std::io::Error),
#[error("The command was executed, but was unsuccessful")]
CommandUnsuccessful(std::process::Command, std::process::Output),
#[error("The mount directory could not be prepared")]
IO(std::path::PathBuf, std::io::Error),
}