[GODRIVER-312] Ensure WriteErrors are returned to the user Created: 26/Mar/18  Updated: 27/Apr/18  Resolved: 27/Apr/18

Status: Closed
Project: Go Driver
Component/s: CRUD
Affects Version/s: 0.0.2
Fix Version/s: 0.0.4

Type: New Feature Priority: Major - P3
Reporter: Kristofer Brandow (Inactive) Assignee: Kristofer Brandow (Inactive)
Resolution: Done Votes: 0
Labels: FreeMonitoring, Stitch, evg
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
causes GODRIVER-307 Insert methods do not seem propogate ... Closed
causes GODRIVER-347 Write errors are not handled for comm... Closed
Epic Link: GODRIVER Alpha UX

 Description   

The current OP_REPLY error parsing code does not account for circumstances where the errmsg, codeName, or code are nested within the response document. This means that for write commands (insert, update, and delete), additional error parsing logic is require to extract the writeErrors.

To fix this problem:

  • Add result.WriteError, result.WriteErrors, and result.WriteConcernError types.
  • Mirror these types in the mongo package as mongo.WriteError, mongo.WriteErrors, mongo.WriteConcernError.
  • Fully implement the result.Delete, result.Insert, and result.Update types to include a result.WriteErrors
  • Make the dispatch methods for Delete, Insert, and Update return an error for for WriteErrors and WriteConcernError
  • Create mongo package errors for WriteErrors and WriteConcernError


 Comments   
Comment by Kristofer Brandow (Inactive) [ 27/Apr/18 ]

Code Review: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/408527.

Comment by Githook User [ 27/Apr/18 ]

Author:

{'email': 'kris@mongodb.com', 'username': 'skriptble', 'name': 'Kris Brandow'}

Message: Ensure write operation error are returned

GODRIVER-312
GODRIVER-307
GODRIVER-347

Change-Id: Ib3321215285029b9602f27ca4a89d588ef643238
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/0dfcbabcc0f2b9032e3f1ce413996c900f52a06c

Comment by Jeffrey Yemin [ 23/Apr/18 ]

For reference, here's the exception thrown by the C# driver: https://github.com/mongodb/mongo-csharp-driver/blob/master/src/MongoDB.Driver/MongoBulkWriteException.cs

Comment by Eric Daniels (Inactive) [ 23/Apr/18 ]

Not sure. May be best to format it as an array of a series of errors.

Comment by Kristofer Brandow (Inactive) [ 23/Apr/18 ]

eric.daniels Yes, but I'm not sure how we should actually stringify the multi-error.

Comment by Eric Daniels (Inactive) [ 20/Apr/18 ]

Will this also handle multiple errors returned from InsertMany for instance?

Generated at Thu Feb 08 08:33:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.