Commit 124235ff authored by Fabian Ruff's avatar Fabian Ruff Committed by GitHub

Fail template execution if included template fails

parent 3a943696
...@@ -138,12 +138,12 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap { ...@@ -138,12 +138,12 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap {
} }
// Add the 'include' function here so we can close over t. // Add the 'include' function here so we can close over t.
funcMap["include"] = func(name string, data interface{}) string { funcMap["include"] = func(name string, data interface{}) (string, error) {
buf := bytes.NewBuffer(nil) buf := bytes.NewBuffer(nil)
if err := t.ExecuteTemplate(buf, name, data); err != nil { if err := t.ExecuteTemplate(buf, name, data); err != nil {
buf.WriteString(err.Error()) return "", err
} }
return buf.String() return buf.String(), nil
} }
// Add the 'required' function here // Add the 'required' function here
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment