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

@ -19,22 +19,22 @@ pub enum GDError {
PacketReceive,
/// Couldn't decompress data.
Decompress,
/// Unknown cast while translating a value to an enum.
UnknownEnumCast,
/// Invalid input.
InvalidInput,
/// Couldn't create a socket connection.
SocketConnect,
/// Couldn't bind a socket.
SocketBind,
/// Couldn't parse a json string.
JsonParse,
/// The server queried is not from the queried game.
BadGame,
/// Invalid input.
InvalidInput,
/// The server queried is not the queried game server.
BadGame(String),
/// Couldn't automatically query.
AutoQuery,
/// A protocol-defined expected format was not met.
ProtocolFormat,
/// Couldn't cast a value to an enum.
UnknownEnumCast,
/// Couldn't parse a json string.
JsonParse,
/// Couldn't parse a value.
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 protocol = info.protocol;
if let App::Source(x) = &app {
if let Some(appid) = x {
if let App::Source(source_app) = &app {
if let Some(appid) = source_app {
if *appid != info.appid {
return Err(BadGame);
return Err(BadGame(format!("AppId: {appid}")));
}
}
}