Skip to content

GODRIVER-3832 Make ClientBulkWriteException implement ServerError#2371

Draft
FGasper wants to merge 1 commit intomongodb:masterfrom
FGasper:GODRIVER-3832-implement-server-error
Draft

GODRIVER-3832 Make ClientBulkWriteException implement ServerError#2371
FGasper wants to merge 1 commit intomongodb:masterfrom
FGasper:GODRIVER-3832-implement-server-error

Conversation

@FGasper
Copy link
Copy Markdown
Contributor

@FGasper FGasper commented Apr 24, 2026

GODRIVER-3832

(NB: I’ll happily add tests if there are no obvious problems with how I’ve implemented this.)

Summary

This makes ClientBulkWriteException implement ServerError. In particular, it fixes the bug where mongo.ErrorCodes returned an empty list from a ClientBulkWriteException.

Background & Motivation

Without making ClientBulkWriteException at least implement errorCoder, mongo.ErrorCodes() gives the wrong result with Client.BulkWrite.

Since it’s fairly straightforward, this changeset adds the additional controls needed for ClientBulkWriteException to implement ServerError.

@mongodb-drivers-pr-bot
Copy link
Copy Markdown
Contributor

API Change Report

./v2/mongo

compatible changes

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

@mongodb-drivers-pr-bot
Copy link
Copy Markdown
Contributor

🧪 Performance Results

Commit SHA: ad2b57b

The following benchmark tests for version 69ebd36170575f00079b6124 had statistically significant changes (i.e., |z-score| > 1.96):

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkSingleFindOneByID ops_per_second_min -72.0140 349.7567 Avg: 1249.7566
Med: 1245.4750
Stdev: 175.5629
0.8959 -5.1264
BenchmarkBSONDeepDocumentEncoding ops_per_second_min -53.8718 1685.7607 Avg: 3654.5142
Med: 3635.9405
Stdev: 552.2253
0.8518 -3.5651
BenchmarkBSONFullDocumentEncoding ops_per_second_max 2.8666 49217.4427 Avg: 47845.8864
Med: 47766.8975
Stdev: 630.9402
0.7648 2.1738
BenchmarkBSONFlatDocumentDecoding total_time_seconds -1.9129 1.1765 Avg: 1.1994
Med: 1.1992
Stdev: 0.0063
0.8557 -3.6565

For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch.

Copy link
Copy Markdown
Contributor

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic and change seem sound. ClientBulkWriteException is a server error, so it makes sense to make it implement the ServerError interface. @FGasper please add tests and we can get this merged! Thanks!

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.

2 participants