fixes #556, humanises connection errors a little (#561)

This commit is contained in:
James Hodgkinson 2021-08-08 13:36:41 +10:00 committed by GitHub
parent b432c79302
commit 9f3352cf71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,9 +8,10 @@
#![deny(clippy::needless_pass_by_value)]
#![deny(clippy::trivially_copy_pass_by_ref)]
use kanidm_client::KanidmClientBuilder;
use std::path::PathBuf;
use kanidm_client::{ClientError, KanidmClientBuilder};
use log::{debug, error};
use structopt::StructOpt;
@ -72,9 +73,13 @@ fn main() {
});
client.auth_simple_password(opt.username.as_str(), password.as_str())
};
if r.is_err() {
eprintln!("Error during authentication phase: {:?}", r);
match r {
Err(ClientError::Transport(value)) => {
error!("Failed to connect to kanidm server: {}", value.to_string());
}
_ => error!("Error during authentication phase: {:?}", r),
}
std::process::exit(1);
}