trash_utils/
error.rs

1use std::io;
2use std::path::PathBuf;
3
4use snafu::Snafu;
5
6pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Debug, Snafu)]
9#[snafu(visibility(pub(crate)))]
10pub enum Error {
11	#[snafu(display("malformed trashinfo path name '{}'", path.display()))]
12	InvalidTrashInfoPath { path: PathBuf },
13
14	#[snafu(display("failed to read trash info dir: {}", source))]
15	ReadTrashInfoDir { source: io::Error },
16
17	#[snafu(display("failed to write file '{}': {}", path.display(), source))]
18	WriteTrashInfo { path: PathBuf, source: io::Error },
19
20	#[snafu(display("failed to read file '{}': {}", path.display(), source))]
21	ReadTrashInfo { path: PathBuf, source: io::Error },
22
23	#[snafu(display("failed to move file '{}': {}", path.display(), source))]
24	MoveFile { path: PathBuf, source: io::Error },
25
26	#[snafu(display("failed to remove file '{}': {}", path.display(), source))]
27	RemoveFile { path: PathBuf, source: io::Error },
28
29	#[snafu(display("file does not exist '{}'", path.display()))]
30	InvalidPath { path: PathBuf },
31
32	#[snafu(display("cannot trash trash-can '{}'", path.display()))]
33	TrashingTrashCan { path: PathBuf },
34
35	#[snafu(display("failed to parse TrashInfo file '{}': {}", path.display(), source))]
36	ParseTrashInfo { path: PathBuf, source: io::Error },
37}