Merge branch 'imbris/error-message-fix' into 'master'

Fix error message when no connection attempts succeed

See merge request veloren/veloren!2465
This commit is contained in:
Imbris 2021-06-18 04:00:28 +00:00
commit 338109149f
2 changed files with 6 additions and 5 deletions

View File

@ -22,6 +22,7 @@ pub enum Error {
mismatched_server_info: Option<ServerInfo>, mismatched_server_info: Option<ServerInfo>,
}, },
ClientCrashed, ClientCrashed,
ServerNotFound,
} }
#[allow(clippy::large_enum_variant)] // TODO: Pending review in #587 #[allow(clippy::large_enum_variant)] // TODO: Pending review in #587
@ -125,11 +126,10 @@ impl ClientInit {
tokio::time::sleep(Duration::from_secs(5)).await; tokio::time::sleep(Duration::from_secs(5)).await;
} }
// Only possibility for no last_err is aborting // Parsing/host name resolution successful but no connection succeeded
let _ = tx.send(Msg::Done(Err(last_err.unwrap_or(Error::ClientError { // If last_err is None this typically means there was no server up at the input
error: ClientError::Other("Connection attempt aborted by user".to_owned()), // address and all the attempts timed out.
mismatched_server_info: None, let _ = tx.send(Msg::Done(Err(last_err.unwrap_or(Error::ServerNotFound))));
}))));
// Safe drop runtime // Safe drop runtime
tokio::task::block_in_place(move || drop(runtime2)); tokio::task::block_in_place(move || drop(runtime2));

View File

@ -432,6 +432,7 @@ fn get_client_msg_error(e: client_init::Error, localized_strings: &LocalizationH
}, },
}, },
InitError::ClientCrashed => localization.get("main.login.client_crashed").into(), InitError::ClientCrashed => localization.get("main.login.client_crashed").into(),
InitError::ServerNotFound => localization.get("main.login.server_not_found").into(),
} }
} }