mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
improve(voxygen): error handling while connecting
This commit is contained in:
parent
7db0ff0b8c
commit
ac5ff453cc
@ -5,6 +5,7 @@ pub mod error;
|
||||
|
||||
// Reexports
|
||||
pub use crate::error::Error;
|
||||
pub use authc::AuthClientError;
|
||||
pub use specs::{
|
||||
join::Join,
|
||||
saveload::{Marker, MarkerAllocator},
|
||||
@ -105,7 +106,7 @@ impl Client {
|
||||
);
|
||||
}
|
||||
|
||||
log::info!("Auth Server: {:?}", server_info.auth_provider);
|
||||
log::debug!("Auth Server: {:?}", server_info.auth_provider);
|
||||
|
||||
// Initialize `State`
|
||||
let mut state = State::default();
|
||||
|
@ -95,7 +95,7 @@ impl ClientInit {
|
||||
Err(err) => {
|
||||
match err {
|
||||
ClientError::Network(PostError::Bincode(_)) => {
|
||||
last_err = Some(Error::ConnectionFailed(err));
|
||||
last_err = Some(Error::ClientError(err));
|
||||
break 'tries;
|
||||
},
|
||||
// Assume the connection failed and try again soon
|
||||
|
@ -75,22 +75,48 @@ impl PlayState for MainMenuState {
|
||||
},
|
||||
Some(InitMsg::Done(Err(err))) => {
|
||||
client_init = None;
|
||||
global_state.info_message = Some(
|
||||
match err {
|
||||
InitError::BadAddress(_) | InitError::NoAddress => "Server not found",
|
||||
global_state.info_message = Some({
|
||||
let err = match err {
|
||||
InitError::BadAddress(_) | InitError::NoAddress => {
|
||||
"Server not found".into()
|
||||
},
|
||||
InitError::ClientError(err) => match err {
|
||||
client::Error::InvalidAuth => "Invalid credentials",
|
||||
client::Error::TooManyPlayers => "Server is full",
|
||||
client::Error::AuthServerNotTrusted => "Auth server not trusted",
|
||||
_ => {
|
||||
error!("Error when trying to connect: {:?}", err);
|
||||
"Connection Failed"
|
||||
client::Error::InvalidAuth => "Invalid credentials".into(),
|
||||
client::Error::TooManyPlayers => "Server is full".into(),
|
||||
client::Error::AuthServerNotTrusted => {
|
||||
"Auth server not trusted".into()
|
||||
},
|
||||
client::Error::ServerWentMad => "ServerWentMad: Probably versions \
|
||||
are incompatible, check for \
|
||||
updates."
|
||||
.into(),
|
||||
client::Error::ServerTimeout => "Timeout: Server did not respond \
|
||||
in time. (Overloaded or network \
|
||||
issues)."
|
||||
.into(),
|
||||
client::Error::ServerShutdown => "Server shut down".into(),
|
||||
client::Error::AlreadyLoggedIn => {
|
||||
"You are already logged into the server.".into()
|
||||
},
|
||||
client::Error::Network(e) => format!("Network error: {:?}", e),
|
||||
client::Error::Other(e) => format!("Error: {}", e),
|
||||
client::Error::AuthClientError(e) => match e {
|
||||
client::AuthClientError::JsonError(e) => {
|
||||
format!("Fatal error: {}", e)
|
||||
},
|
||||
client::AuthClientError::RequestError(e) => {
|
||||
format!("Failed to send request to Auth server: {}", e)
|
||||
},
|
||||
client::AuthClientError::ServerError(_, e) => format!("{}", e),
|
||||
},
|
||||
},
|
||||
InitError::ClientCrashed => "Client crashed",
|
||||
}
|
||||
.to_string(),
|
||||
);
|
||||
InitError::ClientCrashed => "Client crashed".into(),
|
||||
};
|
||||
// Log error for possible additional use later or incase that the error
|
||||
// displayed is cut of.
|
||||
error!("{}", err);
|
||||
err
|
||||
});
|
||||
},
|
||||
Some(InitMsg::IsAuthTrusted(auth_server)) => {
|
||||
if global_state
|
||||
|
@ -281,7 +281,7 @@ impl MainMenuUi {
|
||||
)
|
||||
.font_id(self.fonts.cyri.conrod_id);
|
||||
let (frame_w, frame_h) = if let PopupType::AuthTrustPrompt(_) = popup_type {
|
||||
(65.0 * 8.0, 300.0)
|
||||
(65.0 * 8.0, 370.0)
|
||||
} else {
|
||||
(65.0 * 6.0, 140.0)
|
||||
};
|
||||
@ -747,8 +747,9 @@ impl MainMenuUi {
|
||||
self.popup = Some(PopupData {
|
||||
msg: format!(
|
||||
"Warning: The server you are trying to connect to has provided this \
|
||||
authentication server addresss:\n\n{}\n\nbut it is not in your list of trusted \
|
||||
authentication servers.",
|
||||
authentication server address:\n\n{}\n\nbut it is not in your list of trusted \
|
||||
authentication servers.\n\nMake sure that you trust this site and owner to not \
|
||||
try and bruteforce your password!",
|
||||
&auth_server
|
||||
),
|
||||
popup_type: PopupType::AuthTrustPrompt(auth_server),
|
||||
|
Loading…
Reference in New Issue
Block a user