Print out the error messages more readable

This commit is contained in:
Elias Schriefer 2020-11-05 19:05:41 +01:00
parent 2cab09d30b
commit d18e44d3b9

View File

@ -177,12 +177,20 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO: // TODO:
// Perform operations // Perform operations
match action { let res = match action {
"start" => object.start().await?, "start" => object.start().await,
"stop" => object.stop().await?, "stop" => object.stop().await,
"restart" => object.restart().await?, "restart" => object.restart().await,
"is-running" => info!("Service at path {} is{} running", path, if !object.is_running().await {"n't"} else {""}), "is-running" => {
info!("Service at path {} is{} running", path, if !object.is_running().await {"n't"} else {""});
Ok(())
},
_ => unreachable!("unknown action") _ => unreachable!("unknown action")
};
if let Err(err) = res {
error!("{:?}", err);
std::process::exit(1);
} }
Ok(()) Ok(())