rust_mc_status/
error.rs

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