forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.rs
More file actions
34 lines (24 loc) · 736 Bytes
/
errors.rs
File metadata and controls
34 lines (24 loc) · 736 Bytes
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
use thiserror::Error;
use warp::reject::Reject;
#[derive(Error, Debug)]
pub enum ServerError {
#[error("internal server error")]
InternalServerError,
#[error("info_hash is either missing or invalid")]
InvalidInfoHash,
#[error("peer_id is either missing or invalid")]
InvalidPeerId,
#[error("could not find remote address")]
AddressNotFound,
#[error("torrent has no peers")]
NoPeersFound,
#[error("torrent not on whitelist")]
TorrentNotWhitelisted,
#[error("peer not authenticated")]
PeerNotAuthenticated,
#[error("invalid authentication key")]
PeerKeyNotValid,
#[error("exceeded info_hash limit")]
ExceededInfoHashLimit,
}
impl Reject for ServerError {}