Commit dfffc7a5 authored by Rob Pike's avatar Rob Pike

exp/template: include function name in error returned by function or method call.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/4711049
parent 19e207d2
......@@ -455,7 +455,7 @@ func (s *state) evalCall(dot, fun reflect.Value, name string, args []node, final
result := fun.Call(argv)
// If we have an os.Error that is not nil, stop execution and return that error to the caller.
if len(result) == 2 && !result[1].IsNil() {
s.error(result[1].Interface().(os.Error))
s.errorf("error calling %s: %s", name, result[1].Interface().(os.Error))
}
return result[0]
}
......
......@@ -395,6 +395,9 @@ func TestExecuteError(t *testing.T) {
if err == nil {
t.Errorf("expected error; got none")
} else if !strings.Contains(err.String(), os.EPERM.String()) {
if *debug {
fmt.Printf("test execute error: %s\n", err)
}
t.Errorf("expected os.EPERM; got %s", err)
}
}
......
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