fix crash when cannot connect to the api
This commit is contained in:
parent
6f856a4e96
commit
b499a106d6
1 changed files with 9 additions and 2 deletions
|
@ -5,7 +5,14 @@ pub async fn connexion(token: &str, url: &str) {
|
||||||
let auth = AuthenticationData::from_access_token(&token);
|
let auth = AuthenticationData::from_access_token(&token);
|
||||||
let mut api = Mattermost::new(url, auth);
|
let mut api = Mattermost::new(url, auth);
|
||||||
api.store_session_token().await.unwrap();
|
api.store_session_token().await.unwrap();
|
||||||
let team_info = api.get_team_info("etudiant-es").await.unwrap();
|
let team_info = api.get_team_info("etudiant-es").await;
|
||||||
|
|
||||||
println!("{:?}", team_info);
|
match team_info {
|
||||||
|
Ok(infos) => {
|
||||||
|
println!("Information sur la team : {:?}", infos);
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
println!("Error: {}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue