MCPcopy
hub / github.com/mongodb/node-mongodb-native / isNotWritablePrimaryError

Function isNotWritablePrimaryError

src/error.ts:1509–1520  ·  view source on GitHub ↗
(err: MongoError)

Source from the content-addressed store, hash-verified

1507}
1508
1509function isNotWritablePrimaryError(err: MongoError) {
1510 if (typeof err.code === 'number') {
1511 // If any error code exists, we ignore the error.message
1512 return SDAM_NOT_PRIMARY_CODES.has(err.code);
1513 }
1514
1515 if (isRecoveringError(err)) {
1516 return false;
1517 }
1518
1519 return LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(err.message);
1520}
1521
1522export function isNodeShuttingDownError(err: MongoError): boolean {
1523 return !!(typeof err.code === 'number' && SDAM_NODE_SHUTTING_DOWN_ERROR_CODES.has(err.code));

Callers 1

isStateChangeErrorFunction · 0.85

Calls 3

isRecoveringErrorFunction · 0.85
testMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected