torrust_tracker/servers/udp/
error.rs

1//! Error types for the UDP server.
2use std::panic::Location;
3
4use thiserror::Error;
5use torrust_tracker_located_error::LocatedError;
6
7/// Error returned by the UDP server.
8#[derive(Error, Debug)]
9pub enum Error {
10    /// Error returned when the domain tracker returns an error.
11    #[error("tracker server error: {source}")]
12    TrackerError {
13        source: LocatedError<'static, dyn std::error::Error + Send + Sync>,
14    },
15
16    /// Error returned from a third-party library (`aquatic_udp_protocol`).
17    #[error("internal server error: {message}, {location}")]
18    InternalServer {
19        location: &'static Location<'static>,
20        message: String,
21    },
22
23    /// Error returned when the connection id could not be verified.
24    #[error("connection id could not be verified")]
25    InvalidConnectionId { location: &'static Location<'static> },
26
27    /// Error returned when the request is invalid.
28    #[error("bad request: {source}")]
29    BadRequest {
30        source: LocatedError<'static, dyn std::error::Error + Send + Sync>,
31    },
32
33    /// Error returned when tracker requires authentication.
34    #[error("domain tracker requires authentication but is not supported in current UDP implementation. Location: {location}")]
35    TrackerAuthenticationRequired { location: &'static Location<'static> },
36}