mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-01-30 14:17:25 +00:00
fix game crashing when discord isn't open (lol)
This commit is contained in:
parent
6bccf59f5b
commit
95e09ded99
|
@ -5,7 +5,7 @@ use discord_rich_presence::{
|
||||||
DiscordIpc, DiscordIpcClient,
|
DiscordIpc, DiscordIpcClient,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::framework::error::{GameError, GameResult};
|
use crate::framework::error::GameResult;
|
||||||
use crate::game::{player::Player, shared_game_state::GameDifficulty, stage::StageData};
|
use crate::game::{player::Player, shared_game_state::GameDifficulty, stage::StageData};
|
||||||
|
|
||||||
pub enum DiscordRPCState {
|
pub enum DiscordRPCState {
|
||||||
|
@ -59,7 +59,10 @@ impl DiscordRPC {
|
||||||
|
|
||||||
Ok(())
|
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(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,6 @@ pub enum GameError {
|
||||||
InvalidValue(String),
|
InvalidValue(String),
|
||||||
/// Something went wrong while executing a debug command line command.
|
/// Something went wrong while executing a debug command line command.
|
||||||
CommandLineError(String),
|
CommandLineError(String),
|
||||||
/// Something went wrong while initializing or modifying Discord rich presence values.
|
|
||||||
DiscordRPCError(String),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for GameError {
|
impl fmt::Display for GameError {
|
||||||
|
|
Loading…
Reference in a new issue