Drop automatic message prefix from command errors (#384)

This commit is contained in:
Jan Heuermann
2023-10-07 09:15:33 +02:00
committed by GitHub
parent 46c03841ed
commit 93d31e17f4
5 changed files with 24 additions and 15 deletions
+4 -4
View File
@@ -38,7 +38,7 @@ func TestBindTo(t *testing.T) {
p, err := New(&cli, BindTo(impl("foo"), (*iface)(nil)))
assert.NoError(t, err)
err = callMethod("method", reflect.ValueOf(impl("??")), reflect.ValueOf(method), p.bindings)
err = callFunction(reflect.ValueOf(method), p.bindings)
assert.NoError(t, err)
assert.Equal(t, "foo", saw)
}
@@ -58,8 +58,8 @@ func TestInvalidCallback(t *testing.T) {
p, err := New(&cli, BindTo(impl("foo"), (*iface)(nil)))
assert.NoError(t, err)
err = callMethod("method", reflect.ValueOf(impl("??")), reflect.ValueOf(method), p.bindings)
assert.EqualError(t, err, `kong.impl.method(): return value of func(kong.iface) string must implement "error"`)
err = callFunction(reflect.ValueOf(method), p.bindings)
assert.EqualError(t, err, `return value of func(kong.iface) string must implement "error"`)
}
type zrror struct{}
@@ -83,7 +83,7 @@ func TestCallbackCustomError(t *testing.T) {
p, err := New(&cli, BindTo(impl("foo"), (*iface)(nil)))
assert.NoError(t, err)
err = callMethod("method", reflect.ValueOf(impl("??")), reflect.ValueOf(method), p.bindings)
err = callFunction(reflect.ValueOf(method), p.bindings)
assert.NoError(t, err)
assert.Equal(t, "foo", saw)
}