mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
feat: show errors in main menu when client fails
Instead of `[ERROR] Failed to tick the scene: Network(Bincode(Io(Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" })))`
This commit is contained in:
@ -75,11 +75,11 @@ impl PlayState for MainMenuState {
|
||||
}
|
||||
Some(Err(err)) => {
|
||||
client_init = None;
|
||||
self.main_menu_ui.login_error(
|
||||
global_state.error_message = Some(
|
||||
match err {
|
||||
InitError::BadAddress(_) | InitError::NoAddress => "Server not found",
|
||||
InitError::InvalidAuth => "Invalid credentials",
|
||||
InitError::ServerIsFull => "Server is Full!",
|
||||
InitError::ServerIsFull => "Server is full",
|
||||
InitError::ConnectionFailed(_) => "Connection failed",
|
||||
InitError::ClientCrashed => "Client crashed",
|
||||
}
|
||||
@ -129,8 +129,8 @@ impl PlayState for MainMenuState {
|
||||
false,
|
||||
)));
|
||||
} else {
|
||||
self.main_menu_ui
|
||||
.login_error("Invalid username or password".to_string());
|
||||
global_state.error_message =
|
||||
Some("Invalid username or password".to_string());
|
||||
}
|
||||
}
|
||||
MainMenuEvent::CancelLoginAttempt => {
|
||||
@ -152,6 +152,10 @@ impl PlayState for MainMenuState {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(error) = global_state.error_message.take() {
|
||||
self.main_menu_ui.show_error(error);
|
||||
}
|
||||
|
||||
// Draw the UI to the screen.
|
||||
self.main_menu_ui.render(global_state.window.renderer_mut());
|
||||
|
||||
|
Reference in New Issue
Block a user