X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=api%2Ferrors.go;fp=api%2Fvppapi_errors.go;h=32cc67723c6ec5961fe335d57bb0ceb7fd3d4af1;hb=df67791c6ffc96331f75aec7d3addfe2efca7739;hp=c9ce3a3831f545e7a7fc83875dbaf57968931b14;hpb=ceed73403bdb61387d04be8b47183e9c4a970749;p=govpp.git diff --git a/api/vppapi_errors.go b/api/errors.go similarity index 97% rename from api/vppapi_errors.go rename to api/errors.go index c9ce3a3..32cc677 100644 --- a/api/vppapi_errors.go +++ b/api/errors.go @@ -5,6 +5,17 @@ import ( "strconv" ) +// CompatibilityError is the error type usually returned by CheckCompatibility +// method of Channel. It contains list of all the compatible/incompatible messages. +type CompatibilityError struct { + CompatibleMessages []string + IncompatibleMessages []string +} + +func (c *CompatibilityError) Error() string { + return fmt.Sprintf("%d/%d messages incompatible", len(c.IncompatibleMessages), len(c.CompatibleMessages)+len(c.IncompatibleMessages)) +} + // RetvalToVPPApiError returns error for retval value. // Retval 0 returns nil error. func RetvalToVPPApiError(retval int32) error {