Remove TemplateStringRegistrationError by linking in handlebars error type

This commit is contained in:
Matthias Beyer 2017-09-09 22:04:32 +02:00
parent 4420f7a518
commit 4849cc4822
2 changed files with 9 additions and 15 deletions

View file

@ -22,6 +22,10 @@ error_chain! {
RuntimeError, RuntimeErrorKind, ResultExt, Result;
}
foreign_links {
HandlebarsTemplateError(::handlebars::TemplateError);
}
errors {
Instantiate {
description("Could not instantiate")
@ -73,11 +77,6 @@ error_chain! {
display("Error while reading in TOML document")
}
TemplateStringRegistrationError {
description("Error while registering logging template string")
display("Error while registering logging template string")
}
ConfigMissingLoggingFormatTrace {
description("Missing config for logging format for trace logging")
display("Missing config for logging format for trace logging")

View file

@ -93,28 +93,23 @@ impl ImagLogger {
{
let fmt = try!(aggregate_global_format_trace(matches, config));
try!(handlebars.register_template_string("TRACE", fmt) // name must be uppercase
.chain_err(|| EK::TemplateStringRegistrationError));
try!(handlebars.register_template_string("TRACE", fmt)); // name must be uppercase
}
{
let fmt = try!(aggregate_global_format_debug(matches, config));
try!(handlebars.register_template_string("DEBUG", fmt) // name must be uppercase
.chain_err(|| EK::TemplateStringRegistrationError));
try!(handlebars.register_template_string("DEBUG", fmt)); // name must be uppercase
}
{
let fmt = try!(aggregate_global_format_info(matches, config));
try!(handlebars.register_template_string("INFO", fmt) // name must be uppercase
.chain_err(|| EK::TemplateStringRegistrationError));
try!(handlebars.register_template_string("INFO", fmt)); // name must be uppercase
}
{
let fmt = try!(aggregate_global_format_warn(matches, config));
try!(handlebars.register_template_string("WARN", fmt) // name must be uppercase
.chain_err(|| EK::TemplateStringRegistrationError));
try!(handlebars.register_template_string("WARN", fmt)); // name must be uppercase
}
{
let fmt = try!(aggregate_global_format_error(matches, config));
try!(handlebars.register_template_string("ERROR", fmt) // name must be uppercase
.chain_err(|| EK::TemplateStringRegistrationError));
try!(handlebars.register_template_string("ERROR", fmt)); // name must be uppercase
}
Ok(ImagLogger {