Skip to content

Commit

Permalink
GODRIVER-2536 Return early in replaceErrors. (mongodb#1076)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjirewis authored and Julien-Beezeelinx committed Oct 20, 2022
1 parent 6c12b26 commit 0c10ddd
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 0c10ddd

Please sign in to comment.