mc_server_status/
error.rs

1// Copyright (c) 2025 pynickle. This is a fork of Original Crate. Original copyright: Copyright (c) 2025 NameOfShadow
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum McError {
7    #[error("DNS resolution failed: {0}")]
8    DnsError(String),
9
10    #[error("Connection failed: {0}")]
11    ConnectionError(String),
12
13    #[error("Timeout occurred")]
14    Timeout,
15
16    #[error("Invalid server response: {0}")]
17    InvalidResponse(String),
18
19    #[error("I/O error: {0}")]
20    IoError(#[from] std::io::Error),
21
22    #[error("JSON parsing error: {0}")]
23    JsonError(#[from] serde_json::Error),
24
25    #[error("UTF-8 conversion error: {0}")]
26    Utf8Error(#[from] std::string::FromUtf8Error),
27
28    #[error("Base64 decoding error: {0}")]
29    Base64Error(#[from] base64::DecodeError),
30
31    #[error("Invalid edition: {0}")]
32    InvalidEdition(String),
33
34    #[error("Invalid port: {0}")]
35    InvalidPort(String),
36
37    #[error("Invalid address format: {0}")]
38    InvalidAddress(String),
39}