[CXX-1679] bulk_write class and error handling (error category mismatch?) Created: 31/Oct/18  Updated: 09/Oct/23

Status: Backlog
Project: C++ Driver
Component/s: None
Affects Version/s: 3.4.0
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Sascha Zelzer Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: error-handling, internal-woes
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CXX-2494 Improved Bulk Write API Blocked
Epic Link: C++ Error Improvements

 Description   

Using mongocxx::bulk_write::append() with a document that fails internal validation (e.g. using $ in field names) throws a mongocxx::logic_error exception.

This exception, however, belongs to the server_error_category, which seems weird since it is a client (driver) generated error in libmongoc.

How are users supposed to differentiate std::system_error exceptions if they want to know if the error originated in the server or client? Also, not exposing the libmongoc error domain (e.g. as std::error_condition) makes it really hard to take actions depending on the type of the error.

How are clients of mongo-cxx-driver code supposed to handle this?

 



 Comments   
Comment by A. Jesse Jiryu Davis [ 31/Oct/18 ]

Thanks for the report, we'll try to handle this as part of a general overhaul of the C++ Driver's error handling, scheduled for the near future.

Generated at Wed Feb 07 22:03:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.