use std::panic::Location;
use thiserror::Error;
use torrust_tracker_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("connection id could not be verified")]
InvalidConnectionId { location: &'static Location<'static> },
#[error("bad request: {source}")]
BadRequest {
source: LocatedError<'static, dyn std::error::Error + Send + Sync>,
},
#[error("domain tracker requires authentication but is not supported in current UDP implementation. Location: {location}")]
TrackerAuthenticationRequired { location: &'static Location<'static> },
}