Skip to content

Commit

Permalink
GODRIVER-2536 Return early in replaceErrors. (#1076)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjirewis committed Sep 16, 2022
1 parent 07adc67 commit 60e3958
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mongo/errors.go
Expand Up @@ -46,6 +46,11 @@ func (e ErrMapForOrderedArgument) Error() string {
}

func replaceErrors(err error) error {
// Return nil when err is nil to avoid costly reflection logic below.
if err == nil {
return nil
}

if err == topology.ErrTopologyClosed {
return ErrClientDisconnected
}
Expand Down

0 comments on commit 60e3958

Please sign in to comment.