From 95e09ded992ba0dd5f2a5d29462623be8a37a7fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zsef=20Sallai?= Date: Fri, 24 Feb 2023 13:42:47 +0200 Subject: [PATCH] fix game crashing when discord isn't open (lol) --- src/discord/mod.rs | 7 +++++-- src/framework/error.rs | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/discord/mod.rs b/src/discord/mod.rs index cd47439..381a99f 100644 --- a/src/discord/mod.rs +++ b/src/discord/mod.rs @@ -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(()) + } } } diff --git a/src/framework/error.rs b/src/framework/error.rs index 27f4ed6..3b3769c 100644 --- a/src/framework/error.rs +++ b/src/framework/error.rs @@ -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 {