(err: MongoError)
| 1507 | } |
| 1508 | |
| 1509 | function 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 | |
| 1522 | export function isNodeShuttingDownError(err: MongoError): boolean { |
| 1523 | return !!(typeof err.code === 'number' && SDAM_NODE_SHUTTING_DOWN_ERROR_CODES.has(err.code)); |
no test coverage detected