[CXX-987] Can't construct operation_exception without a server error Created: 10/Aug/16  Updated: 15/Sep/16  Resolved: 15/Sep/16

Status: Closed
Project: C++ Driver
Component/s: API, Implementation
Affects Version/s: 3.0.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: David Golden Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

As mentioned in a comment in CXX-986:
> In addition, I think the implementation of operation_exception is incomplete; _raw_server_error is stdx::optional<bsoncxx::document::value>, but there is no way to construct operation_exception without a valid bsoncxx::document::value.



 Comments   
Comment by J Rassi [ 15/Sep/16 ]

The premise of this ticket is that mongocxx::operation_exception does not have a constructor which leaves the _raw_server_error member unset. This premise is not correct, as the inheriting constructors mongocxx:operation_exception declares from mongocxx::exception all leave _raw_server_error unset. mongocxx:operation_exception is actually usually constructed without a raw server error. This is presumably due to the fact that most libmongoc methods that perform database operations (e.g. mongoc_collection_count(), mongoc_collection_insert(), mongoc_collection_rename(), etc.) don't expose the raw reply document; they instead populate a bson_error_t* out-argument in the case of error, which does not contain the raw server reply.

As such, I'm closing this ticket "Works as Designed".

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