Skip to content

Commit

Permalink
client: Aggregate DB parsing errors
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Moreno <[email protected]>
  • Loading branch information
amorenoz committed Mar 18, 2021
1 parent 5b7695d commit a64bd72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit a64bd72

Please sign in to comment.