Skip to content

Commit 404feab

Browse files
benjirewisbenjirewis
authored andcommitted
GODRIVER-2536 Return early in replaceErrors. (#1076)
1 parent d0c497a commit 404feab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mongo/errors.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ func (e ErrMapForOrderedArgument) Error() string {
4646
}
4747

4848
func replaceErrors(err error) error {
49+
// Return nil when err is nil to avoid costly reflection logic below.
50+
if err == nil {
51+
return nil
52+
}
53+
4954
if err == topology.ErrTopologyClosed {
5055
return ErrClientDisconnected
5156
}

0 commit comments

Comments
 (0)