Skip to content

GODRIVER-3954: Implement ServerErrorInterface for ClientBulkWriteException - #2606

Open
ayesha-ilm wants to merge 6 commits into
mongodb:masterfrom
ayesha-ilm:GODRIVER-3954
Open

ayesha-ilm wants to merge 6 commits into
mongodb:masterfrom
ayesha-ilm:GODRIVER-3954

Conversation

@ayesha-ilm

@ayesha-ilm ayesha-ilm commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

GODRIVER-3954

Summary

ClientBulkWriteException now implements the full ServerError interface.

Background & Motivation

ClientBulkWriteException did not implement the full ServerError interface. As a result, errors.As(err, &serverErr) returns false for a client bulk write error, and the idiomatic server-error detection path.

What I have done

added missing interface functions:

  • HasErrorLabel
  • HasErrorMessage
  • HasErrorCodeWithMessage

to ClientBulkWriteException

Test Plans

Just repurposed some of the tests already in TestServerErrorr from other exceptions to apply to ClientBulkWriteException

@ayesha-ilm
ayesha-ilm marked this pull request as ready for review September 16, 2026 14:42
@ayesha-ilm
ayesha-ilm requested a review from a team as a code owner September 16, 2026 14:42
@mongodb-drivers-pr-bot

Copy link
Copy Markdown
Contributor

API Change Report

./v2/mongo

compatible changes

ClientBulkWriteException.HasErrorCode: added
ClientBulkWriteException.HasErrorCodeWithMessage: added
ClientBulkWriteException.HasErrorLabel: added
ClientBulkWriteException.HasErrorMessage: added
ClientBulkWriteException.Labels: added

Comment thread mongo/errors.go Outdated
Comment thread mongo/errors.go
Comment thread mongo/client_bulk_write.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants