From 166653b355c53c379daa74d15b94f754d7fc9fdc Mon Sep 17 00:00:00 2001 From: Christof Petig Date: Thu, 14 Mar 2024 00:21:18 +0100 Subject: [PATCH] report plugin errors to the user --- common/state/src/plugin/mod.rs | 2 +- voxygen/src/menu/char_selection/mod.rs | 13 ++++++++----- voxygen/src/menu/main/mod.rs | 13 ++++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/common/state/src/plugin/mod.rs b/common/state/src/plugin/mod.rs index 5ff2c32017..bb37436a04 100644 --- a/common/state/src/plugin/mod.rs +++ b/common/state/src/plugin/mod.rs @@ -243,7 +243,7 @@ impl PluginMgr { base_dir: &Path, data: Vec, ) -> Result { - let path = store_server_plugin(base_dir, data)?; + let path = store_server_plugin(base_dir, data).map_err(PluginError::Io)?; self.load_server_plugin(path) } diff --git a/voxygen/src/menu/char_selection/mod.rs b/voxygen/src/menu/char_selection/mod.rs index 7641ad3fa8..09f23532fb 100644 --- a/voxygen/src/menu/char_selection/mod.rs +++ b/voxygen/src/menu/char_selection/mod.rs @@ -282,16 +282,19 @@ impl PlayState for CharSelectionState { tracing::info!("plugin data {}", data.len()); let mut client = self.client.borrow_mut(); #[cfg(feature = "plugins")] - if let Ok(hash) = client + match client .state() .ecs() .write_resource::() .cache_server_plugin(&global_state.config_dir, data) { - if client.plugin_received(hash) == 0 { - // now load characters (plugins might contain items) - client.load_character_list(); - } + Ok(hash) => { + if client.plugin_received(hash) == 0 { + // now load characters (plugins might contain items) + client.load_character_list(); + } + }, + Err(e) => tracing::error!(?e, "cache_server_plugin"), } }, // TODO: See if we should handle StartSpectate here instead. diff --git a/voxygen/src/menu/main/mod.rs b/voxygen/src/menu/main/mod.rs index 3c27443b30..5b924692c7 100644 --- a/voxygen/src/menu/main/mod.rs +++ b/voxygen/src/menu/main/mod.rs @@ -284,16 +284,19 @@ impl PlayState for MainMenuState { tracing::info!("plugin data {}", data.len()); if let InitState::Pipeline(client) = &mut self.init { #[cfg(feature = "plugins")] - if let Ok(hash) = client + match client .state() .ecs() .write_resource::() .cache_server_plugin(&global_state.config_dir, data) { - if client.plugin_received(hash) == 0 { - // now load characters (plugins might contain items) - client.load_character_list(); - } + Ok(hash) => { + if client.plugin_received(hash) == 0 { + // now load characters (plugins might contain items) + client.load_character_list(); + } + }, + Err(e) => tracing::error!(?e, "cache_server_plugin"), } } },