Check the case with invalid token
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
extern crate core;
|
||||
|
||||
use std::error::Error;
|
||||
use std::io::ErrorKind;
|
||||
use std::sync::Arc;
|
||||
|
||||
use futures::future::join_all;
|
||||
@ -39,11 +40,13 @@ async fn get_server_config(conf: &ClientConfig) -> Result<RemoteConfig, Box<dyn
|
||||
.send()
|
||||
.await?;
|
||||
if req.status().as_u16() != 200 {
|
||||
log::error!(
|
||||
"Could not retrieve configuration! (got status {})",
|
||||
req.status()
|
||||
);
|
||||
std::process::exit(2);
|
||||
Err(std::io::Error::new(
|
||||
ErrorKind::Other,
|
||||
format!(
|
||||
"Could not retrieve configuration! (got status {})",
|
||||
req.status()
|
||||
),
|
||||
))?;
|
||||
}
|
||||
|
||||
Ok(req.json::<RemoteConfig>().await?)
|
||||
@ -70,8 +73,11 @@ pub async fn run_app(mut args: ClientConfig) -> std::io::Result<()> {
|
||||
let remote_conf = match get_server_config(&args).await {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
log::error!("Failed to fetch relay configuration from server! {}", e);
|
||||
panic!();
|
||||
Err(std::io::Error::new(
|
||||
ErrorKind::Other,
|
||||
format!("Failed to fetch relay configuration from server! {}", e),
|
||||
))?;
|
||||
unreachable!();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user