From 9ae0eae4c19fbb3d2cd5e0c4d180baadea356d64 Mon Sep 17 00:00:00 2001 From: Oliver Steele Date: Tue, 27 Jun 2017 22:56:41 -0400 Subject: [PATCH] Display filename for liquid render errors --- pipelines/pipeline.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pipelines/pipeline.go b/pipelines/pipeline.go index 0b0964b..ae485ac 100644 --- a/pipelines/pipeline.go +++ b/pipelines/pipeline.go @@ -89,8 +89,8 @@ func (p *Pipeline) renderTemplate(b []byte, e templates.VariableMap, filename st return b, err } -// ApplyLayout applies the named layout to bytes. -func (p *Pipeline) ApplyLayout(name string, b []byte, e templates.VariableMap) ([]byte, error) { +// ApplyLayout applies the named layout to the data. +func (p *Pipeline) ApplyLayout(name string, data []byte, e templates.VariableMap) ([]byte, error) { for name != "" { var lfm templates.VariableMap t, err := p.FindLayout(name, &lfm) @@ -98,16 +98,16 @@ func (p *Pipeline) ApplyLayout(name string, b []byte, e templates.VariableMap) ( return nil, err } le := templates.MergeVariableMaps(e, templates.VariableMap{ - "content": string(b), + "content": string(data), "layout": lfm, }) - b, err = t.Render(le) + data, err = t.Render(le) if err != nil { - return nil, err + return nil, helpers.PathError(err, "render template", name) } name = lfm.String("layout", "") } - return b, nil + return data, nil } func (p *Pipeline) makeLocalLiquidEngine() liquid.Engine {