You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This class is only meant to be constructed within the driver. This constructor is
357
+
* not subject to semantic versioning compatibility guarantees and may change at any time.
358
+
*
359
+
* @public
360
+
**/
361
+
constructor(
362
+
serverDescription: ServerDescription,
363
+
maxSetVersion: number|null,
364
+
maxElectionId: ObjectId|null,
365
+
options?: {cause?: Error}
366
+
){
367
+
super(
368
+
`primary marked stale due to electionId/setVersion mismatch: server setVersion: ${serverDescription.setVersion}, server electionId: ${serverDescription.electionId}, topology setVersion: ${maxSetVersion}, topology electionId: ${maxElectionId}`,
369
+
options
370
+
);
371
+
}
372
+
373
+
overridegetname(): string{
374
+
return'MongoStalePrimaryError';
375
+
}
376
+
}
377
+
343
378
/**
344
379
* An error generated when a batch command is re-executed after one of the commands in the batch
// Restore the stub before asserting anything in case of errors
347
-
checkOutStub.restore();
348
-
349
-
constisApplicationError=error=>{
350
-
// These errors all come from the withConnection stub
351
-
return(
352
-
errorinstanceofMongoNetworkError||
353
-
errorinstanceofMongoNetworkTimeoutError||
354
-
errorinstanceofMongoServerError
355
-
);
356
-
};
357
-
expect(
358
-
thrownError,
359
-
`expected the error thrown to be one of MongoNetworkError, MongoNetworkTimeoutError or MongoServerError (referred to in the spec as an "Application Error") got ${thrownError.name}${thrownError.stack}`
360
-
).to.satisfy(isApplicationError);
328
+
try{
329
+
for(constphaseoftestData.phases){
330
+
// Determine which of the two kinds of phases we're running
// Restore the stub before asserting anything in case of errors
351
+
checkOutStub.restore();
352
+
353
+
constisApplicationError=error=>{
354
+
// These errors all come from the withConnection stub
355
+
return(
356
+
errorinstanceofMongoNetworkError||
357
+
errorinstanceofMongoNetworkTimeoutError||
358
+
errorinstanceofMongoServerError
359
+
);
360
+
};
361
+
expect(
362
+
thrownError,
363
+
`expected the error thrown to be one of MongoNetworkError, MongoNetworkTimeoutError or MongoServerError (referred to in the spec as an "Application Error") got ${thrownError.name}${thrownError.stack}`
0 commit comments