1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum FlattenError {
5 #[error("源文件夹不存在 | Source directory does not exist: {0}")]
6 SourceNotFound(String),
7
8 #[error("源路径不是文件夹 | Source path is not a directory: {0}")]
9 SourceNotDirectory(String),
10
11 #[error("目标文件夹不能在源文件夹内部 | Target directory cannot be inside source directory")]
12 TargetInsideSource,
13
14 #[error("无法创建目标文件夹 | Failed to create target directory: {0}")]
15 CreateTargetDirFailed(String),
16
17 #[error("无法删除已存在的目标文件 | Failed to remove existing target file: {0}")]
18 RemoveExistingFileFailed(String),
19
20 #[error("移动文件失败 | Failed to move file: {0} -> {1}")]
21 MoveFileFailed(String, String),
22
23 #[error("复制文件失败 | Failed to copy file: {0} -> {1}")]
24 CopyFileFailed(String, String),
25
26 #[error("IO 错误 | IO error: {0}")]
27 IoError(#[from] std::io::Error),
28}
29
30pub type Result<T> = std::result::Result<T, FlattenError>;