mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
report plugin errors to the user
This commit is contained in:
parent
8dd4729965
commit
166653b355
@ -243,7 +243,7 @@ impl PluginMgr {
|
||||
base_dir: &Path,
|
||||
data: Vec<u8>,
|
||||
) -> Result<PluginHash, PluginError> {
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -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::<PluginMgr>()
|
||||
.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.
|
||||
|
@ -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::<PluginMgr>()
|
||||
.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"),
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user