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 5, 2021
1 parent bdd34c4 commit 9bb1280
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions 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,13 @@ func newRPC2Client(conn net.Conn) (*OvsdbClient, error) {
ovs.Apis[db] = NewNativeAPI(schema)
} else {
c.Close()
errors = append(errors, err.Error())
return nil, err
}
}
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 9bb1280

Please sign in to comment.