aboutsummaryrefslogtreecommitdiffstats
path: root/adapter/vppapiclient/stat_client.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-05-31 08:56:20 +0200
committerOndrej Fabry <ofabry@cisco.com>2019-05-31 08:56:20 +0200
commit3f0489044a1fbc6539aa8c57ffce6d7b00de7d82 (patch)
tree430770c075de85bcbef72ebe2548bce4208da326 /adapter/vppapiclient/stat_client.go
parentdf781c9bcf64ba93d0ab7ce62573d93c2bf93d4e (diff)
Support for error vectors
- this fixes compilation error for VPP 19.08 and keeps backwards compatibility with previous versions Change-Id: Ib58557a090caa5e8342c0cb21de8af684cb18137 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'adapter/vppapiclient/stat_client.go')
-rw-r--r--adapter/vppapiclient/stat_client.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/adapter/vppapiclient/stat_client.go b/adapter/vppapiclient/stat_client.go
index 2615b65..389c93b 100644
--- a/adapter/vppapiclient/stat_client.go
+++ b/adapter/vppapiclient/stat_client.go
@@ -71,6 +71,13 @@ func (c *statClient) Connect() error {
sockName = c.socketName
}
+ if _, err := os.Stat(sockName); err != nil {
+ if os.IsNotExist(err) {
+ return fmt.Errorf("stats socket file %q does not exists, ensure that VPP is running with `statseg { ... }` section in config", sockName)
+ }
+ return fmt.Errorf("stats socket file error: %v", err)
+ }
+
rc := C.govpp_stat_connect(C.CString(sockName))
if rc != 0 {
return fmt.Errorf("connecting to VPP stats API failed (rc=%v)", rc)