Remove errors details as they were quite useless

This commit is contained in:
CosminPerRam 2023-01-13 00:11:04 +02:00
parent e8619a7df1
commit c263b17651
13 changed files with 103 additions and 116 deletions

View file

@ -1,6 +1,7 @@
use crate::{GDError, GDResult};
use crate::GDResult;
use crate::bufferer::{Bufferer, Endianess};
use crate::GDError::{PacketBad, ProtocolFormat};
use crate::protocols::minecraft::{LegacyGroup, Response, Server};
use crate::protocols::minecraft::protocol::legacy_v1_6::LegacyV1_6;
use crate::protocols::types::TimeoutSettings;
@ -31,7 +32,7 @@ impl LegacyV1_4 {
let mut buffer = Bufferer::new_with_data(Endianess::Big, &self.socket.receive(None)?);
if buffer.get_u8()? != 0xFF {
return Err(GDError::ProtocolFormat("Expected 0xFF at the begin of the packet.".to_string()));
return Err(ProtocolFormat);
}
let length = buffer.get_u16()? * 2;
@ -48,9 +49,9 @@ impl LegacyV1_4 {
let description = split[0].to_string();
let online_players = split[1].parse()
.map_err(|_| GDError::PacketBad("Failed to parse to expected int.".to_string()))?;
.map_err(|_| PacketBad)?;
let max_players = split[2].parse()
.map_err(|_| GDError::PacketBad("Failed to parse to expected int.".to_string()))?;
.map_err(|_| PacketBad)?;
Ok(Response {
version_name: "1.4+".to_string(),