Revert error details for the BadGame error

This commit is contained in:
CosminPerRam 2023-01-13 00:39:58 +02:00
parent c263b17651
commit e72d7bdf8b
3 changed files with 12 additions and 11 deletions

View file

@ -8,6 +8,7 @@ Valve Protocol: Players with no name are no more added to the `players_details`
### Breaking: ### Breaking:
Valve Protocol: The rules field is now a `HashMap<String, String>` instead of a `Vec<ServerRule>` (where the `ServerRule` structure had a name and a value fields). Valve Protocol: The rules field is now a `HashMap<String, String>` instead of a `Vec<ServerRule>` (where the `ServerRule` structure had a name and a value fields).
Errors: Besides the `BadGame` error, now no other errors returns details about what happened (as it was quite pointless).
# 0.0.7 - 03/01/2023 # 0.0.7 - 03/01/2023
### Changes: ### Changes:

View file

@ -19,22 +19,22 @@ pub enum GDError {
PacketReceive, PacketReceive,
/// Couldn't decompress data. /// Couldn't decompress data.
Decompress, Decompress,
/// Unknown cast while translating a value to an enum.
UnknownEnumCast,
/// Invalid input.
InvalidInput,
/// Couldn't create a socket connection. /// Couldn't create a socket connection.
SocketConnect, SocketConnect,
/// Couldn't bind a socket. /// Couldn't bind a socket.
SocketBind, SocketBind,
/// Couldn't parse a json string. /// Invalid input.
JsonParse, InvalidInput,
/// The server queried is not from the queried game. /// The server queried is not the queried game server.
BadGame, BadGame(String),
/// Couldn't automatically query. /// Couldn't automatically query.
AutoQuery, AutoQuery,
/// A protocol-defined expected format was not met. /// A protocol-defined expected format was not met.
ProtocolFormat, ProtocolFormat,
/// Couldn't cast a value to an enum.
UnknownEnumCast,
/// Couldn't parse a json string.
JsonParse,
/// Couldn't parse a value. /// Couldn't parse a value.
TypeParse, TypeParse,
} }

View file

@ -430,10 +430,10 @@ fn get_response(address: &str, port: u16, app: App, gather_settings: GatheringSe
let info = client.get_server_info(&app)?; let info = client.get_server_info(&app)?;
let protocol = info.protocol; let protocol = info.protocol;
if let App::Source(x) = &app { if let App::Source(source_app) = &app {
if let Some(appid) = x { if let Some(appid) = source_app {
if *appid != info.appid { if *appid != info.appid {
return Err(BadGame); return Err(BadGame(format!("AppId: {appid}")));
} }
} }
} }