1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum MoshroomError {
5 #[error("Problem with io")]
6 IoError(std::io::Error),
7 #[error("VarInt may be up to 5 bytes")]
8 VarIntTooLong,
9 #[error("VarInt may be up to 5 bytes")]
10 WrongPacket(crate::varint::VarInt),
11 #[error("VarInt may be up to 5 bytes")]
12 InvalidHandshakeState(i32),
13 #[error("invalid string")]
14 InvalidString(std::string::FromUtf8Error)
15}
16
17impl From<std::io::Error> for MoshroomError {
18 fn from(e: std::io::Error) -> Self {
19 Self::IoError(e)
20 }
21}
22
23pub type Result<T> = std::result::Result<T, MoshroomError>;