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(
22 "The default mount path (/mnt/sshfs) could not be prepared. Mounting there will fail until this is fixed"
23 )]
24 DefaultBasePathIO(std::path::PathBuf, std::io::Error),
25
26 #[error(
28 "A test directory under the default mount path (/mnt/sshfs) could not be prepared. Mounting there will fail until this is fixed"
29 )]
30 TestUnderBasePathIO(std::path::PathBuf, std::io::Error),
31}
32
33#[derive(Error, Debug)]
34pub enum SftpManError {
35 #[error("Generic error")]
37 Generic(String),
38
39 #[error("The mounts configuration directory does not exist")]
41 NoMountsConfigDirectory,
42
43 #[error("The current mounts could not be parsed")]
45 MountListParse(#[from] mnt::ParseError),
46
47 #[error("The mount config definition could not be read")]
49 FilesystemMountDefinitionRead(std::path::PathBuf, std::io::Error),
50
51 #[error("The mount config definition could not be removed")]
53 FilesystemMountDefinitionRemove(std::path::PathBuf, std::io::Error),
54
55 #[error("The mount config definition could not be parsed")]
57 JSON(std::path::PathBuf, serde_json::Error),
58
59 #[error("The mount path was found, but it was not of the expected type")]
61 MountVfsTypeMismatch {
62 path: std::path::PathBuf,
63 found_vfs_type: String,
64 expected_vfs_type: String,
65 },
66
67 #[error("The mount command could not be constructed")]
69 MountCommandBuilding(String),
70
71 #[error("The mount command could not be executed")]
73 CommandExecution(std::process::Command, std::io::Error),
74
75 #[error("The command was executed, but was unsuccessful")]
77 CommandUnsuccessful(std::process::Command, std::process::Output),
78
79 #[error("The mount directory could not be prepared")]
81 IO(std::path::PathBuf, std::io::Error),
82}