fix game crashing when discord isn't open (lol)

This commit is contained in:
József Sallai 2023-02-24 13:42:47 +02:00
parent 6bccf59f5b
commit 95e09ded99
2 changed files with 5 additions and 4 deletions

View File

@ -5,7 +5,7 @@ use discord_rich_presence::{
DiscordIpc, DiscordIpcClient,
};
use crate::framework::error::{GameError, GameResult};
use crate::framework::error::GameResult;
use crate::game::{player::Player, shared_game_state::GameDifficulty, stage::StageData};
pub enum DiscordRPCState {
@ -59,7 +59,10 @@ impl DiscordRPC {
Ok(())
}
Err(e) => Err(GameError::DiscordRPCError(e.to_string())),
Err(e) => {
log::warn!("Failed to start Discord RPC client (maybe Discord is not running?): {}", e);
Ok(())
}
}
}

View File

@ -44,8 +44,6 @@ pub enum GameError {
InvalidValue(String),
/// Something went wrong while executing a debug command line command.
CommandLineError(String),
/// Something went wrong while initializing or modifying Discord rich presence values.
DiscordRPCError(String),
}
impl fmt::Display for GameError {