From 892683bef86cacc2ccda2b4df2b079171bd92164 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Wed, 22 Aug 2018 06:07:04 +0200 Subject: Show VPPApiError value always and remove RegisterBinAPITypes for mock adapter Change-Id: I3b216748df1a372f25cc94e3df5d7b1b2b7a8a40 Signed-off-by: Ondrej Fabry --- core/channel.go | 5 ++--- core/channel_test.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/channel.go b/core/channel.go index 5f7763e..718f89c 100644 --- a/core/channel.go +++ b/core/channel.go @@ -261,9 +261,8 @@ func (ch *channel) processReply(reply *vppReply, expSeqNum uint16, msg api.Messa if strings.HasSuffix(msg.GetMessageName(), "_reply") { // TODO: use categories for messages to avoid checking message name if f := reflect.Indirect(reflect.ValueOf(msg)).FieldByName("Retval"); f.IsValid() { - if retval := f.Int(); retval != 0 { - err = api.VPPApiError(retval) - } + retval := int32(f.Int()) + err = api.RetvalToVPPApiError(retval) } } diff --git a/core/channel_test.go b/core/channel_test.go index 197dda4..4a9ab2b 100644 --- a/core/channel_test.go +++ b/core/channel_test.go @@ -37,7 +37,7 @@ func setupTest(t *testing.T) *testCtx { RegisterTestingT(t) ctx := &testCtx{ - mockVpp: &mock.VppAdapter{}, + mockVpp: mock.NewVppAdapter(), } var err error -- cgit