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:
@ -243,7 +243,7 @@ impl PluginMgr {
|
|||||||
base_dir: &Path,
|
base_dir: &Path,
|
||||||
data: Vec<u8>,
|
data: Vec<u8>,
|
||||||
) -> Result<PluginHash, PluginError> {
|
) -> 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)
|
self.load_server_plugin(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,16 +282,19 @@ impl PlayState for CharSelectionState {
|
|||||||
tracing::info!("plugin data {}", data.len());
|
tracing::info!("plugin data {}", data.len());
|
||||||
let mut client = self.client.borrow_mut();
|
let mut client = self.client.borrow_mut();
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
if let Ok(hash) = client
|
match client
|
||||||
.state()
|
.state()
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_resource::<PluginMgr>()
|
.write_resource::<PluginMgr>()
|
||||||
.cache_server_plugin(&global_state.config_dir, data)
|
.cache_server_plugin(&global_state.config_dir, data)
|
||||||
{
|
{
|
||||||
if client.plugin_received(hash) == 0 {
|
Ok(hash) => {
|
||||||
// now load characters (plugins might contain items)
|
if client.plugin_received(hash) == 0 {
|
||||||
client.load_character_list();
|
// 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.
|
// TODO: See if we should handle StartSpectate here instead.
|
||||||
|
@ -284,16 +284,19 @@ impl PlayState for MainMenuState {
|
|||||||
tracing::info!("plugin data {}", data.len());
|
tracing::info!("plugin data {}", data.len());
|
||||||
if let InitState::Pipeline(client) = &mut self.init {
|
if let InitState::Pipeline(client) = &mut self.init {
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
if let Ok(hash) = client
|
match client
|
||||||
.state()
|
.state()
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_resource::<PluginMgr>()
|
.write_resource::<PluginMgr>()
|
||||||
.cache_server_plugin(&global_state.config_dir, data)
|
.cache_server_plugin(&global_state.config_dir, data)
|
||||||
{
|
{
|
||||||
if client.plugin_received(hash) == 0 {
|
Ok(hash) => {
|
||||||
// now load characters (plugins might contain items)
|
if client.plugin_received(hash) == 0 {
|
||||||
client.load_character_list();
|
// now load characters (plugins might contain items)
|
||||||
}
|
client.load_character_list();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => tracing::error!(?e, "cache_server_plugin"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user