Skip to content

Commit

Permalink
Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai committed Aug 31, 2017
1 parent e032b2a commit cc62d2b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions plugins/database/mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ func (m *MongoDB) CreateUser(statements dbplugin.Statements, usernameConfig dbpl
}

err = session.DB(mongoCS.DB).Run(createUserCmd, nil)
switch err {
case nil:
case io.EOF || strings.Contains(err.Error(), "EOF"):
switch {
case err == nil:
case err == io.EOF, strings.Contains(err.Error(), "EOF"):
if err := m.ConnectionProducer.Close(); err != nil {
return "", "", errwrap.Wrapf("error closing EOF'd mongo connection: {{err}}", err)
}
Expand Down Expand Up @@ -182,10 +182,9 @@ func (m *MongoDB) RevokeUser(statements dbplugin.Statements, username string) er
}

err = session.DB(db).RemoveUser(username)
switch err {
case nil:
case mgo.ErrNotFound:
case io.EOF || strings.Contains(err.Error(), "EOF"):
switch {
case err == nil, err == mgo.ErrNotFound:
case err == io.EOF, strings.Contains(err.Error(), "EOF"):
if err := m.ConnectionProducer.Close(); err != nil {
return errwrap.Wrapf("error closing EOF'd mongo connection: {{err}}", err)
}
Expand Down

0 comments on commit cc62d2b

Please sign in to comment.