mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'kaedr/pretty_printing_error_messages' into 'master'
Fixed obfuscation of error messages caused by previous MR (pretty printing error messages) See merge request veloren/veloren!2935
This commit is contained in:
commit
1e61a279cc
@ -60,11 +60,17 @@ https://veloren.net/account/."#,
|
||||
"main.login.select_language": "Select a language",
|
||||
"main.login.client_version": "Client Version",
|
||||
"main.login.server_version": "Server Version",
|
||||
"main.login.client_init_failed": "Client failed to initialize.",
|
||||
"main.login.client_init_failed": "Client failed to initialize: {init_fail_reason}",
|
||||
"main.login.username_bad_characters": "Username contains invalid characters! (Only alphanumeric, '_' and '-' are allowed)",
|
||||
"main.login.username_too_long": "Username is too long! Max length is: {max_len}",
|
||||
"main.servers.select_server": "Select a server",
|
||||
"main.servers.singleplayer_error": "Failed to connect to internal server.",
|
||||
"main.servers.singleplayer_error": "Failed to connect to internal server: {sp_error}",
|
||||
"main.servers.network_error": "Server network/socket error: {raw_error}",
|
||||
"main.servers.participant_error": "Participant disconnect/protocol error: {raw_error}",
|
||||
"main.servers.stream_error": "Client connection/compression/(de)serialization error: {raw_error}",
|
||||
"main.servers.database_error": "Server database error: {raw_error}",
|
||||
"main.servers.persistence_error": "Server persistence error (Probably Asset/Character Data related): {raw_error}",
|
||||
"main.servers.other_error": "Server general error: {raw_error}",
|
||||
|
||||
// Credits screen
|
||||
"main.credits": "Credits",
|
||||
|
@ -113,17 +113,43 @@ impl PlayState for MainMenuState {
|
||||
global_state.singleplayer = None;
|
||||
self.init = InitState::None;
|
||||
self.main_menu_ui.cancel_connection();
|
||||
let server_err = match e {
|
||||
server::Error::NetworkErr(e) => localized_strings
|
||||
.get("main.servers.network_error")
|
||||
.to_owned()
|
||||
.replace("{raw_error}", e.to_string().as_str()),
|
||||
server::Error::ParticipantErr(e) => localized_strings
|
||||
.get("main.servers.participant_error")
|
||||
.to_owned()
|
||||
.replace("{raw_error}", e.to_string().as_str()),
|
||||
server::Error::StreamErr(e) => localized_strings
|
||||
.get("main.servers.stream_error")
|
||||
.to_owned()
|
||||
.replace("{raw_error}", e.to_string().as_str()),
|
||||
server::Error::DatabaseErr(e) => localized_strings
|
||||
.get("main.servers.database_error")
|
||||
.to_owned()
|
||||
.replace("{raw_error}", e.to_string().as_str()),
|
||||
server::Error::PersistenceErr(e) => localized_strings
|
||||
.get("main.servers.persistence_error")
|
||||
.to_owned()
|
||||
.replace("{raw_error}", e.to_string().as_str()),
|
||||
server::Error::Other(e) => localized_strings
|
||||
.get("main.servers.other_error")
|
||||
.to_owned()
|
||||
.replace("{raw_error}", e.as_str()),
|
||||
};
|
||||
global_state.info_message = Some(
|
||||
localized_strings
|
||||
.get("main.servers.singleplayer_error")
|
||||
.to_owned(),
|
||||
.to_owned()
|
||||
.replace("{sp_error}", server_err.as_str()),
|
||||
);
|
||||
},
|
||||
Err(_) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle window events.
|
||||
for event in events {
|
||||
// Pass all events to the ui first.
|
||||
@ -154,7 +180,8 @@ impl PlayState for MainMenuState {
|
||||
global_state.info_message = Some(
|
||||
localized_strings
|
||||
.get("main.login.client_init_failed")
|
||||
.to_owned(),
|
||||
.to_owned()
|
||||
.replace("{init_fail_reason}", e.as_str()),
|
||||
);
|
||||
},
|
||||
Some(InitMsg::IsAuthTrusted(auth_server)) => {
|
||||
|
@ -24,6 +24,7 @@ use crate::settings::Settings;
|
||||
use common::assets::{self, AssetExt};
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use std::time::Duration;
|
||||
use tracing::warn;
|
||||
|
||||
// TODO: what is this? (showed up in rebase)
|
||||
//const COL1: Color = Color::Rgba(0.07, 0.1, 0.1, 0.9);
|
||||
@ -455,11 +456,15 @@ impl Controls {
|
||||
}
|
||||
|
||||
fn connection_error(&mut self, error: String) {
|
||||
if matches!(&self.screen, Screen::Connecting { .. }) {
|
||||
if matches!(&self.screen, Screen::Connecting { .. })
|
||||
|| matches!(&self.screen, Screen::Login { .. })
|
||||
{
|
||||
self.screen = Screen::Login {
|
||||
screen: Box::new(login::Screen::new()),
|
||||
error: Some(error),
|
||||
}
|
||||
} else {
|
||||
warn!("connection_error invoked on unhandled screen!");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user