Skip to content

Commit

Permalink
improved another error message
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Nov 3, 2017
1 parent 9be8b0f commit 7df6c66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (c *compiler) evalIdentifier(node *ast.Identifier) (interface{}, error) {
if !f.IsValid() {
m := rv.MethodByName(node.Value)
if !m.IsValid() {
return nil, errors.WithStack(errors.Errorf("%s is an invalid value - evalIdentifier", node))
return nil, errors.WithStack(errors.Errorf("'%s' does not have a field or method named '%s' (%s)", node.Callee.String(), node.Value, node))
}
return m.Interface(), nil
}
Expand Down
2 changes: 1 addition & 1 deletion plush_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func Test_Render_UnknownAttribute_on_Callee(t *testing.T) {
input := `<%= m.Foo %>`
_, err := Render(input, ctx)
r.Error(err)
r.Contains(err.Error(), "m.Foo")
r.Contains(err.Error(), "'m' does not have a field or method named 'Foo' (m.Foo)")
}

type Robot struct {
Expand Down

0 comments on commit 7df6c66

Please sign in to comment.