mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-24 13:07:00 +01:00
Fix 421 - clearer debug messages when doing things (#422)
This commit is contained in:
parent
6f222f6408
commit
01e9aa982d
|
@ -21,11 +21,15 @@ pub fn read_tokens() -> Result<BTreeMap<String, String>, ()> {
|
||||||
return Ok(BTreeMap::new());
|
return Ok(BTreeMap::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug!("Attempting to read tokens from {:?}", &token_path);
|
||||||
// If the file does not exist, return Ok<map>
|
// If the file does not exist, return Ok<map>
|
||||||
let file = match File::open(&token_path) {
|
let file = match File::open(&token_path) {
|
||||||
Ok(f) => f,
|
Ok(f) => f,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("Can not read from {}, continuing ... {:?}", TOKEN_PATH, e);
|
warn!(
|
||||||
|
"Cannot read tokens from {} due to error: {:?} ... continuing.",
|
||||||
|
TOKEN_PATH, e
|
||||||
|
);
|
||||||
return Ok(BTreeMap::new());
|
return Ok(BTreeMap::new());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -33,7 +37,10 @@ pub fn read_tokens() -> Result<BTreeMap<String, String>, ()> {
|
||||||
|
|
||||||
// Else try to read
|
// Else try to read
|
||||||
serde_json::from_reader(reader).map_err(|e| {
|
serde_json::from_reader(reader).map_err(|e| {
|
||||||
error!("JSON/IO error -> {:?}", e);
|
error!(
|
||||||
|
"JSON/IO error reading tokens from {:?} -> {:?}",
|
||||||
|
&token_path, e
|
||||||
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +83,10 @@ pub fn write_tokens(tokens: &BTreeMap<String, String>) -> Result<(), ()> {
|
||||||
|
|
||||||
let writer = BufWriter::new(file);
|
let writer = BufWriter::new(file);
|
||||||
serde_json::to_writer_pretty(writer, tokens).map_err(|e| {
|
serde_json::to_writer_pretty(writer, tokens).map_err(|e| {
|
||||||
error!("JSON/IO error -> {:?}", e);
|
error!(
|
||||||
|
"JSON/IO error writing tokens to file {:?} -> {:?}",
|
||||||
|
&token_path, e
|
||||||
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue