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

Function isResumableError

src/error.ts:1541–1567  ·  view source on GitHub ↗
(error?: Error, wireVersion?: number)

Source from the content-addressed store, hash-verified

1539}
1540
1541export function isResumableError(error?: Error, wireVersion?: number): boolean {
1542 if (error == null || !(error instanceof MongoError)) {
1543 return false;
1544 }
1545
1546 if (error instanceof MongoNetworkError) {
1547 return true;
1548 }
1549
1550 if (error instanceof MongoServerSelectionError) {
1551 return true;
1552 }
1553
1554 if (wireVersion != null && wireVersion >= 9) {
1555 // DRIVERS-1308: For 4.4 drivers running against 4.4 servers, drivers will add a special case to treat the CursorNotFound error code as resumable
1556 if (error.code === MONGODB_ERROR_CODES.CursorNotFound) {
1557 return true;
1558 }
1559 return error.hasErrorLabel(MongoErrorLabel.ResumableChangeStreamError);
1560 }
1561
1562 if (typeof error.code === 'number') {
1563 return GET_MORE_RESUMABLE_CODES.has(error.code);
1564 }
1565
1566 return false;
1567}

Callers 3

error.test.tsFile · 0.85

Calls 2

hasErrorLabelMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected