Skip to content
This repository has been archived by the owner on Apr 18, 2019. It is now read-only.

Commit

Permalink
address send/sync issue in rendering errors
Browse files Browse the repository at this point in the history
Signed-off-by: mwrock <matt@mattwrock.com>
  • Loading branch information
mwrock committed Nov 29, 2018
1 parent aedded8 commit f320dff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions components/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ pub enum Error {
/// When an error occurs registering template file
TemplateFileError(handlebars::TemplateFileError),
/// When an error occurs rendering template
TemplateRenderError(handlebars::RenderError),
/// The error is constructed with a handlebars::RenderError's format string instead
/// of the handlebars::RenderError itself because the cause field of the
/// handlebars::RenderError in the handlebars crate version we use implements send
/// and not sync which can lead to upstream compile errors when dealing with the
/// failure crate.
/// See https://github.com/sunng87/handlebars-rust/issues/194
TemplateRenderError(String),
/// When an error occurs merging toml
TomlMergeError(String),
/// When an error occurs parsing toml
Expand Down Expand Up @@ -347,7 +353,7 @@ impl fmt::Display for Error {
Error::StringFromUtf8Error(ref e) => format!("{}", e),
Error::TargetMatchError(ref e) => format!("{}", e),
Error::TemplateFileError(ref err) => format!("{:?}", err),
Error::TemplateRenderError(ref err) => format!("{}", err),
Error::TemplateRenderError(ref e) => format!("{}", e),
Error::TomlMergeError(ref e) => format!("Failed to merge TOML: {}", e),
Error::TomlParser(ref err) => format!("Failed to parse TOML: {}", err),
Error::UnameFailed(ref e) => format!("{}", e),
Expand Down Expand Up @@ -495,7 +501,7 @@ impl error::Error for Error {
Error::GetExitCodeProcessFailed(_) => "GetExitCodeProcess failed",
Error::WaitForSingleObjectFailed(_) => "WaitForSingleObjectFailed failed",
Error::TemplateFileError(ref err) => err.description(),
Error::TemplateRenderError(ref err) => err.description(),
Error::TemplateRenderError(_) => "Failed to render template",
Error::TerminateProcessFailed(_) => "Failed to call TerminateProcess",
Error::TomlMergeError(_) => "Failed to merge TOML!",
Error::TomlParser(_) => "Failed to parse TOML!",
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/templating/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl TemplateRenderer {
debug!("Rendering template with context, {}, {}", template, raw);
self.0
.render(template, &raw)
.map_err(|e| Error::TemplateRenderError(e))
.map_err(|e| Error::TemplateRenderError(format!("{}", e)))
}
}

Expand Down

0 comments on commit f320dff

Please sign in to comment.