Remove TomlReadError by linking in ::toml_query::error::Error

This commit is contained in:
Matthias Beyer 2017-09-09 22:09:36 +02:00
parent 4849cc4822
commit a015b07f6a
2 changed files with 4 additions and 8 deletions

View file

@ -23,6 +23,7 @@ error_chain! {
}
foreign_links {
TomlError(::toml_query::error::Error);
HandlebarsTemplateError(::handlebars::TemplateError);
}
@ -72,11 +73,6 @@ error_chain! {
display("Invalid log level specification: Only 'trace', 'debug', 'info', 'warn', 'error' are allowed")
}
TomlReadError {
description("Error while reading in TOML document")
display("Error while reading in TOML document")
}
ConfigMissingLoggingFormatTrace {
description("Missing config for logging format for trace logging")
display("Missing config for logging format for trace logging")

View file

@ -374,21 +374,21 @@ fn aggregate_module_settings(_matches: &ArgMatches, config: Option<&Configuratio
Ok(Some(&Value::Array(ref a))) => translate_destinations(a).map(Some),
Ok(None) => Ok(None),
Ok(Some(_)) => Err(RE::from_kind(EK::ConfigTypeError)),
Err(e) => Err(e).chain_err(|| EK::TomlReadError),
Err(e) => Err(e).map_err(From::from),
});
let level = try!(match v.read("level") {
Ok(Some(&Value::String(ref s))) => match_log_level_str(s).map(Some),
Ok(None) => Ok(None),
Ok(Some(_)) => Err(RE::from_kind(EK::ConfigTypeError)),
Err(e) => Err(e).chain_err(|| EK::TomlReadError),
Err(e) => Err(e).map_err(From::from),
});
let enabled = try!(match v.read("enabled") {
Ok(Some(&Value::Boolean(b))) => Ok(b),
Ok(None) => Ok(false),
Ok(Some(_)) => Err(RE::from_kind(EK::ConfigTypeError)),
Err(e) => Err(e).chain_err(|| EK::TomlReadError),
Err(e) => Err(e).map_err(From::from),
});
let module_settings = ModuleSettings {