From a64bd72a81fb922f6d201604ec7f955c8b07ed01 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Fri, 5 Mar 2021 12:54:55 +0100 Subject: [PATCH] client: Aggregate DB parsing errors Signed-off-by: Adrian Moreno --- client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 2ee8c9c1..a2a37628 100644 --- a/client.go +++ b/client.go @@ -90,6 +90,7 @@ func Connect(endpoints string, tlsConfig *tls.Config) (*OvsdbClient, error) { } func newRPC2Client(conn net.Conn) (*OvsdbClient, error) { + var errors []string c := rpc2.NewClientWithCodec(jsonrpc.NewJSONCodec(conn)) c.SetBlocking(true) c.Handle("echo", echo) @@ -114,9 +115,12 @@ func newRPC2Client(conn net.Conn) (*OvsdbClient, error) { ovs.Apis[db] = NewNativeAPI(schema) } else { c.Close() - return nil, err + errors = append(errors, err.Error()) } } + if len(errors) > 0 { + return nil, fmt.Errorf("Multiple DB Errors: %s", strings.Join(errors, ",")) + } connectionsMutex.Lock() defer connectionsMutex.Unlock()