Skip to content

Commit c548e7b

Browse files
Apply suggestions from code review
Co-authored-by: Copilot <[email protected]>
1 parent 91c8094 commit c548e7b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

x/mongo/driver/errors.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,13 @@ func ExtractErrorFromServerResponse(doc bsoncore.Document) error {
578578
// WriteErrors which represent individual operation failures within the context
579579
// of a write command.
580580
func errorCodes(err error) []int32 {
581-
if driversErr, ok := err.(Error); ok {
582-
return []int32{driversErr.Code}
581+
switch e := err.(type) {
582+
case Error:
583+
return []int32{e.Code}
584+
case *Error:
585+
if e != nil {
586+
return []int32{e.Code}
587+
}
583588
}
584-
585589
return nil
586590
}

0 commit comments

Comments
 (0)