mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
Better Error Message (#2998)
* fix(cli) better error Messages --------- Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
This commit is contained in:
parent
77938ed85f
commit
b53c4ba62a
|
@ -41,21 +41,19 @@ mod webauthn;
|
||||||
/// Throws an error and exits the program when we get an error
|
/// Throws an error and exits the program when we get an error
|
||||||
pub(crate) fn handle_client_error(response: ClientError, _output_mode: OutputMode) {
|
pub(crate) fn handle_client_error(response: ClientError, _output_mode: OutputMode) {
|
||||||
match response {
|
match response {
|
||||||
ClientError::Http(status, error, message) => {
|
ClientError::Http(status, error, opid) => {
|
||||||
let error_msg = match error {
|
let error_msg = match error {
|
||||||
Some(msg) => format!(" {:?}", msg),
|
Some(msg) => format!(" {:?}", msg),
|
||||||
None => "".to_string(),
|
None => "".to_string(),
|
||||||
};
|
};
|
||||||
|
error!("OperationId: {:?}", opid);
|
||||||
if status == StatusCode::INTERNAL_SERVER_ERROR {
|
if status == StatusCode::INTERNAL_SERVER_ERROR {
|
||||||
error!(
|
error!("Internal Server Error in response: {}", error_msg);
|
||||||
"Internal Server Error in response:{:?} {:?}",
|
|
||||||
error_msg, message
|
|
||||||
);
|
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
} else if status == StatusCode::NOT_FOUND {
|
} else if status == StatusCode::NOT_FOUND {
|
||||||
error!("Item not found:{:?} {:?}", error_msg, message)
|
error!("Item not found: Check all names are correct.");
|
||||||
} else {
|
} else {
|
||||||
error!("HTTP Error: {}{} {:?}", status, error_msg, message);
|
error!("HTTP Error: {}{}", status, error_msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClientError::Transport(e) => {
|
ClientError::Transport(e) => {
|
||||||
|
|
Loading…
Reference in a new issue