Print out the error messages more readable
This commit is contained in:
parent
2cab09d30b
commit
d18e44d3b9
@ -177,12 +177,20 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// TODO:
|
||||
// Perform operations
|
||||
match action {
|
||||
"start" => object.start().await?,
|
||||
"stop" => object.stop().await?,
|
||||
"restart" => object.restart().await?,
|
||||
"is-running" => info!("Service at path {} is{} running", path, if !object.is_running().await {"n't"} else {""}),
|
||||
let res = match action {
|
||||
"start" => object.start().await,
|
||||
"stop" => object.stop().await,
|
||||
"restart" => object.restart().await,
|
||||
"is-running" => {
|
||||
info!("Service at path {} is{} running", path, if !object.is_running().await {"n't"} else {""});
|
||||
Ok(())
|
||||
},
|
||||
_ => unreachable!("unknown action")
|
||||
};
|
||||
|
||||
if let Err(err) = res {
|
||||
error!("{:?}", err);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user