gobuffalo / plush

The powerful template system that Go needs
MIT License
901 stars 56 forks source link

template.Exec should not erase error type #96

Closed mh-cbon closed 3 years ago

mh-cbon commented 5 years ago

given a template such as

<%= fn() %>

a context such as

type aSpecificErrorType struct { error }
ctx.Set("fn", func() error { return aSpecificErrorType{} })

the template.Exec method should not wrap the error in a way that erase its type.

Such deletion happens in statements like errors.WithStack(errors.Errorf("line %d: %s", s.T().LineNumber, err))

I would like that the error is wrapped using errors.Wraper methods so i can use err = errors.Cause(err) to retrieve the underlying error i m interesting in.

paganotoni commented 3 years ago

This one should be solved in #141.