1
0
mirror of https://github.com/golang/go synced 2024-10-04 01:21:21 -06:00

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
This commit is contained in:
Rob Pike 2011-07-14 11:32:06 +10:00
parent 19e207d24d
commit dfffc7a5d5
2 changed files with 4 additions and 1 deletions

View File

@ -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]
}

View File

@ -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)
}
}