forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patherror.rs
More file actions
40 lines (31 loc) · 1.04 KB
/
error.rs
File metadata and controls
40 lines (31 loc) · 1.04 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
37
38
39
40
use std::panic::Location;
use thiserror::Error;
use warp::reject::Reject;
use crate::located_error::LocatedError;
#[derive(Error, Debug)]
pub enum Error {
#[error("tracker server error: {source}")]
TrackerError {
source: LocatedError<'static, dyn std::error::Error + Send + Sync>,
},
#[error("internal server error: {message}, {location}")]
InternalServer {
location: &'static Location<'static>,
message: String,
},
#[error("no valid infohashes found, {location}")]
EmptyInfoHash { location: &'static Location<'static> },
#[error("peer_id is either missing or invalid, {location}")]
InvalidPeerId { location: &'static Location<'static> },
#[error("could not find remote address: {message}, {location}")]
AddressNotFound {
location: &'static Location<'static>,
message: String,
},
#[error("too many infohashes: {message}, {location}")]
TwoManyInfoHashes {
location: &'static Location<'static>,
message: String,
},
}
impl Reject for Error {}