summaryrefslogtreecommitdiffstats
path: root/core/channel.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/channel.go')
-rw-r--r--core/channel.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/channel.go b/core/channel.go
index 5b513e3..363a267 100644
--- a/core/channel.go
+++ b/core/channel.go
@@ -23,6 +23,7 @@ import (
"github.com/sirupsen/logrus"
+ "git.fd.io/govpp.git/adapter"
"git.fd.io/govpp.git/api"
)
@@ -144,14 +145,23 @@ func (ch *Channel) SendMultiRequest(msg api.Message) api.MultiRequestCtx {
}
func (ch *Channel) CheckCompatiblity(msgs ...api.Message) error {
+ var comperr api.CompatibilityError
for _, msg := range msgs {
- // TODO: collect all incompatible messages and return summarized error
_, err := ch.msgIdentifier.GetMessageID(msg)
if err != nil {
+ if uerr, ok := err.(*adapter.UnknownMsgError); ok {
+ m := fmt.Sprintf("%s_%s", uerr.MsgName, uerr.MsgCrc)
+ comperr.IncompatibleMessages = append(comperr.IncompatibleMessages, m)
+ continue
+ }
+ // other errors return immediatelly
return err
}
}
- return nil
+ if len(comperr.IncompatibleMessages) == 0 {
+ return nil
+ }
+ return &comperr
}
func (ch *Channel) SubscribeNotification(notifChan chan api.Message, event api.Message) (api.SubscriptionCtx, error) {