add println error macro

This commit is contained in:
Mylloon 2022-01-04 18:32:13 +01:00
parent ee11a54195
commit f897c54ce9
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 9 additions and 9 deletions

View file

@ -1,4 +1,4 @@
/// Jolie message d'erreur
/// Renvoie un jolie message d'erreur
pub fn message_erreur(message: &str) -> String {
format!(
"\n{sep}\n{msg}\n{sep}\n",
@ -6,3 +6,9 @@ pub fn message_erreur(message: &str) -> String {
msg = message
)
}
/// Affiche un jolie message d'erreur
#[allow(dead_code)] // mauvaise détection alors on retire se warning
pub fn affiche_message_erreur(message: &str) {
println!("{}", message_erreur(message))
}

View file

@ -114,10 +114,7 @@ pub async fn team_info(api: &mattermost_api::client::Mattermost, equipe: &str) {
println!("{}", infos.fprint());
}
Err(e) => {
println!(
"{}",
erreur::message_erreur(&format!("[Display Team Info] Error: {}", e))
);
erreur::affiche_message_erreur(&format!("[Display Team Info] Error: {}", e));
}
}
}
@ -159,10 +156,7 @@ pub async fn start_mattermost(connection: ConnectionInfoWebsocket) {
println!("{}", res);
}
Err(e) => {
println!(
"{}",
erreur::message_erreur(&format!("[Websocket] Error: {}", e))
);
erreur::affiche_message_erreur(&format!("[Websocket] Error: {}", e));
}
}
}