Use type assertions rather than reflection to determine how to call the Action

This has some benefits, but results in possibly less informative error
messaging; however, given that there are only two accepted types,
I think the error messaging is sufficient.
This commit is contained in:
Jesse Szwedko
2016-11-01 20:33:12 -07:00
parent 3eb41f1bb1
commit b377b5d9e9
2 changed files with 14 additions and 44 deletions

View File

@@ -1492,7 +1492,7 @@ func TestHandleAction_WithNonFuncAction(t *testing.T) {
t.Fatalf("expected to receive a *ExitError")
}
if !strings.HasPrefix(exitErr.Error(), "ERROR invalid Action type") {
if !strings.HasPrefix(exitErr.Error(), "ERROR invalid Action type.") {
t.Fatalf("expected an unknown Action error, but got: %v", exitErr.Error())
}
@@ -1516,7 +1516,7 @@ func TestHandleAction_WithInvalidFuncSignature(t *testing.T) {
t.Fatalf("expected to receive a *ExitError")
}
if !strings.HasPrefix(exitErr.Error(), "ERROR unknown Action error") {
if !strings.HasPrefix(exitErr.Error(), "ERROR invalid Action type") {
t.Fatalf("expected an unknown Action error, but got: %v", exitErr.Error())
}
@@ -1540,7 +1540,7 @@ func TestHandleAction_WithInvalidFuncReturnSignature(t *testing.T) {
t.Fatalf("expected to receive a *ExitError")
}
if !strings.HasPrefix(exitErr.Error(), "ERROR invalid Action signature") {
if !strings.HasPrefix(exitErr.Error(), "ERROR invalid Action type") {
t.Fatalf("expected an invalid Action signature error, but got: %v", exitErr.Error())
}