-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherror.rs
More file actions
36 lines (33 loc) · 1.23 KB
/
Copy patherror.rs
File metadata and controls
36 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use snafu::prelude::*;
use crate::state::error::AppStateError;
use crate::state::logger::LoggerError;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
pub enum ContentFolderError {
#[snafu(display("There is already a content folder called `{name}` in the current folder."))]
NameTaken { name: String },
#[snafu(display("The folder name is invalid. It must not contain slashes."))]
NameInvalid,
#[snafu(display("The folder path must appear absolute"))]
PathInvalid,
#[snafu(display("Folder {id} does not exist."))]
NotFound { id: i32 },
#[snafu(display("The content folder id is invalid: {id}"))]
IDInvalid { id: String },
#[snafu(display("Database error"))]
DB { source: sea_orm::DbErr },
#[snafu(display("Failed to save the operation log"))]
Logger { source: LoggerError },
#[snafu(display("Failed to create the folder on disk"))]
IO { source: std::io::Error },
#[snafu(display("Failed to load the torrent {id} requested to be moved"))]
MovingTorrent {
id: i32,
source: crate::database::torrent::TorrentError,
},
}
impl From<ContentFolderError> for AppStateError {
fn from(e: ContentFolderError) -> Self {
Self::ContentFolder { source: e }
}
}