Improve I/O and BadType config error messages.

This commit is contained in:
Sergio Benitez 2017-08-31 19:05:35 -07:00
parent 3ed0201c6e
commit 2b3aa01463
2 changed files with 4 additions and 4 deletions

View File

@ -497,14 +497,14 @@ impl Config {
// Load the certificates.
let certs = tls::load_certs(certs_path)
.map_err(|e| match e {
Io(e) => ConfigError::Io(e, "tls"),
Io(e) => ConfigError::Io(e, "tls.certs"),
_ => self.bad_type("tls", pem_err, "a valid certificates file")
})?;
// And now the private key.
let key = tls::load_private_key(key_path)
.map_err(|e| match e {
Io(e) => ConfigError::Io(e, "tls"),
Io(e) => ConfigError::Io(e, "tls.key"),
_ => self.bad_type("tls", pem_err, "a valid private key file")
})?;

View File

@ -59,7 +59,7 @@ impl ConfigError {
NotFound => error!("config file was not found"),
IoError => error!("failed reading the config file: IO error"),
Io(ref error, param) => {
error_!("I/O error while setting '{}':", White.paint(param));
error!("I/O error while setting {}:", White.paint(param));
info_!("{}", error);
}
BadFilePath(ref path, reason) => {
@ -77,7 +77,7 @@ impl ConfigError {
info_!("valid environments are: {}", White.paint(valid_envs));
}
BadType(ref name, expected, actual, ref filename) => {
error!("'{}' key could not be parsed", name);
error!("{} key could not be parsed", White.paint(name));
info_!("in {:?}", White.paint(filename));
info_!("expected value to be {}, but found {}",
White.paint(expected), White.paint(actual));