1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum ManagerInitError {
5 #[error("The config directory could not be determined")]
7 NoConfigDirectory,
8}
9
10#[derive(Error, Debug)]
11pub enum PreflightCheckError {
12 #[error("A required command could not be executed")]
14 CommandExecution(std::process::Command, std::io::Error),
15
16 #[error("A required command was executed, but was unsuccessful")]
18 CommandUnsuccessful(std::process::Command, std::process::Output),
19
20 #[error("The default mount path (/mnt/sshfs) could not be prepared. Mounting there will fail until this is fixed")]
22 DefaultBasePathIO(std::path::PathBuf, std::io::Error),
23
24 #[error("A test directory under the default mount path (/mnt/sshfs) could not be prepared. Mounting there will fail until this is fixed")]
26 TestUnderBasePathIO(std::path::PathBuf, std::io::Error),
27}
28
29#[derive(Error, Debug)]
30pub enum SftpManError {
31 #[error("Generic error")]
33 Generic(String),
34
35 #[error("The mounts configuration directory does not exist")]
37 NoMountsConfigDirectory,
38
39 #[error("The current mounts could not be parsed")]
41 MountListParse(#[from] mnt::ParseError),
42
43 #[error("The mount config definition could not be read")]
45 FilesystemMountDefinitionRead(std::path::PathBuf, std::io::Error),
46
47 #[error("The mount config definition could not be removed")]
49 FilesystemMountDefinitionRemove(std::path::PathBuf, std::io::Error),
50
51 #[error("The mount config definition could not be parsed")]
53 JSON(std::path::PathBuf, serde_json::Error),
54
55 #[error("The mount path was found, but it was not of the expected type")]
57 MountVfsTypeMismatch {
58 path: std::path::PathBuf,
59 found_vfs_type: String,
60 expected_vfs_type: String,
61 },
62
63 #[error("The mount command could not be constructed")]
65 MountCommandBuilding(String),
66
67 #[error("The mount command could not be executed")]
69 CommandExecution(std::process::Command, std::io::Error),
70
71 #[error("The command was executed, but was unsuccessful")]
73 CommandUnsuccessful(std::process::Command, std::process::Output),
74
75 #[error("The mount directory could not be prepared")]
77 IO(std::path::PathBuf, std::io::Error),
78}