Improve error message when socket not found (#412)

This commit is contained in:
Firstyear 2021-04-14 10:28:00 +10:00 committed by GitHub
parent 72dfe1b035
commit d4f852837b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,7 @@ extern crate log;
use log::debug; use log::debug;
use structopt::StructOpt; use structopt::StructOpt;
use std::path::PathBuf;
// use futures::executor::block_on; // use futures::executor::block_on;
@ -44,15 +45,20 @@ fn main() {
let req = ClientRequest::Status; let req = ClientRequest::Status;
match call_daemon_blocking(cfg.sock_path.as_str(), req) { let spath = PathBuf::from(cfg.sock_path.as_str());
Ok(r) => match r { if !spath.exists() {
ClientResponse::Ok => info!("working!"), error!("kanidm_unixd socket {} does not exist - is the service running?", cfg.sock_path)
_ => { } else {
error!("Error: unexpected response -> {:?}", r); match call_daemon_blocking(cfg.sock_path.as_str(), req) {
Ok(r) => match r {
ClientResponse::Ok => info!("working!"),
_ => {
error!("Error: unexpected response -> {:?}", r);
}
},
Err(e) => {
error!("Error -> {:?}", e);
} }
},
Err(e) => {
error!("Error -> {:?}", e);
} }
} }
} }