This repository was archived by the owner on Feb 4, 2022. It is now read-only.
File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -581,11 +581,11 @@ function messageHandler(self) {
581
581
}
582
582
583
583
if ( responseDoc . writeConcernError ) {
584
- return handleOperationCallback (
585
- self ,
586
- workItem . cb ,
587
- new MongoWriteConcernError ( responseDoc . writeConcernError )
588
- ) ;
584
+ const err =
585
+ responseDoc . ok === 1
586
+ ? new MongoWriteConcernError ( responseDoc . writeConcernError , responseDoc )
587
+ : new MongoWriteConcernError ( responseDoc . writeConcernError ) ;
588
+ return handleOperationCallback ( self , workItem . cb , err ) ;
589
589
}
590
590
}
591
591
Original file line number Diff line number Diff line change @@ -130,13 +130,19 @@ function isRetryableError(error) {
130
130
*
131
131
* @class
132
132
* @param {Error|string|object } message The error message
133
+ * @param {object } result The result document (provided if ok: 1)
133
134
* @property {string } message The error message
135
+ * @property {object } [result] The result document (provided if ok: 1)
134
136
* @return {MongoWriteConcernError } A MongoWriteConcernError instance
135
137
* @extends {MongoError }
136
138
*/
137
- const MongoWriteConcernError = function ( message ) {
139
+ const MongoWriteConcernError = function ( message , result ) {
138
140
MongoError . call ( this , message ) ;
139
141
this . name = 'MongoWriteConcernError' ;
142
+
143
+ if ( result != null ) {
144
+ this . result = result ;
145
+ }
140
146
} ;
141
147
util . inherits ( MongoWriteConcernError , MongoError ) ;
142
148
You can’t perform that action at this time.
0 commit comments