Check retval value and convert to error in generated RPC client code
[govpp.git] / binapi / bond / bond_rpc.ba.go
index 5e60f84..67fc538 100644 (file)
@@ -5,12 +5,13 @@ package bond
 import (
        "context"
        "fmt"
+       "io"
+
        api "git.fd.io/govpp.git/api"
        vpe "git.fd.io/govpp.git/binapi/vpe"
-       "io"
 )
 
-// RPCService defines RPC service  bond.
+// RPCService defines RPC service bond.
 type RPCService interface {
        BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error)
        BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error)
@@ -35,7 +36,7 @@ func (c *serviceClient) BondCreate(ctx context.Context, in *BondCreate) (*BondCr
        if err != nil {
                return nil, err
        }
-       return out, nil
+       return out, api.RetvalToVPPApiError(out.Retval)
 }
 
 func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) {
@@ -44,7 +45,7 @@ func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDe
        if err != nil {
                return nil, err
        }
-       return out, nil
+       return out, api.RetvalToVPPApiError(out.Retval)
 }
 
 func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) {
@@ -53,7 +54,7 @@ func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave
        if err != nil {
                return nil, err
        }
-       return out, nil
+       return out, api.RetvalToVPPApiError(out.Retval)
 }
 
 func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) {
@@ -62,7 +63,7 @@ func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*Bond
        if err != nil {
                return nil, err
        }
-       return out, nil
+       return out, api.RetvalToVPPApiError(out.Retval)
 }
 
 func (c *serviceClient) SwInterfaceBondDump(ctx context.Context, in *SwInterfaceBondDump) (RPCService_SwInterfaceBondDumpClient, error) {
@@ -110,7 +111,7 @@ func (c *serviceClient) SwInterfaceSetBondWeight(ctx context.Context, in *SwInte
        if err != nil {
                return nil, err
        }
-       return out, nil
+       return out, api.RetvalToVPPApiError(out.Retval)
 }
 
 func (c *serviceClient) SwInterfaceSlaveDump(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_SwInterfaceSlaveDumpClient, error) {