add println error macro
This commit is contained in:
parent
ee11a54195
commit
f897c54ce9
2 changed files with 9 additions and 9 deletions
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue