mirror of
https://github.com/golang/go
synced 2024-11-25 07:37:57 -07: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:
parent
19e207d24d
commit
dfffc7a5d5
@ -455,7 +455,7 @@ func (s *state) evalCall(dot, fun reflect.Value, name string, args []node, final
|
|||||||
result := fun.Call(argv)
|
result := fun.Call(argv)
|
||||||
// If we have an os.Error that is not nil, stop execution and return that error to the caller.
|
// 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() {
|
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]
|
return result[0]
|
||||||
}
|
}
|
||||||
|
@ -395,6 +395,9 @@ func TestExecuteError(t *testing.T) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
t.Errorf("expected error; got none")
|
t.Errorf("expected error; got none")
|
||||||
} else if !strings.Contains(err.String(), os.EPERM.String()) {
|
} 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)
|
t.Errorf("expected os.EPERM; got %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user