Skip to main content

irontide_tracker/
error.rs

1/// Convenience result type for tracker operations.
2pub type Result<T> = std::result::Result<T, Error>;
3
4/// Errors that can occur during tracker communication.
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7    /// Tracker returned an error message.
8    #[error("tracker returned error: {0}")]
9    TrackerError(String),
10
11    /// Invalid or malformed tracker response.
12    #[error("invalid tracker response: {0}")]
13    InvalidResponse(String),
14
15    /// UDP tracker protocol error.
16    #[error("UDP protocol error: {0}")]
17    UdpProtocol(String),
18
19    /// Request timed out.
20    #[error("connection timed out")]
21    Timeout,
22
23    /// Bencode deserialization error.
24    #[error("bencode: {0}")]
25    Bencode(#[from] irontide_bencode::Error),
26
27    /// HTTP request error.
28    #[error("HTTP: {0}")]
29    Http(#[from] reqwest::Error),
30
31    /// Underlying I/O error.
32    #[error("I/O: {0}")]
33    Io(#[from] std::io::Error),
34
35    /// Invalid tracker URL.
36    #[error("invalid URL: {0}")]
37    InvalidUrl(String),
38
39    /// URL blocked by security policy (e.g., SSRF mitigation).
40    #[error("URL security policy violation: {0}")]
41    SecurityViolation(String),
42}