fix(config): log as error if failure to read config wasn't caused by NotFound (#1993)

This commit is contained in:
David Knaack 2020-12-13 16:24:48 +01:00 committed by GitHub
parent f311c3cbf5
commit 60be453797
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ use indexmap::IndexMap;
use std::clone::Clone;
use std::collections::HashMap;
use std::io::ErrorKind;
use std::marker::Sized;
use std::env;
@ -236,7 +237,13 @@ impl StarshipConfig {
Some(content)
}
Err(e) => {
log::debug!("Unable to read config file content: {}", &e);
let level = if e.kind() == ErrorKind::NotFound {
log::Level::Debug
} else {
log::Level::Error
};
log::log!(level, "Unable to read config file content: {}", &e);
None
}
}?;