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

Method _processErrorIteratorMode

src/change_stream.ts:1044–1073  ·  view source on GitHub ↗

@internal

(changeStreamError: AnyError, cursorInitialized: boolean)

Source from the content-addressed store, hash-verified

1042
1043 /** @internal */
1044 private async _processErrorIteratorMode(changeStreamError: AnyError, cursorInitialized: boolean) {
1045 if (this.isClosed) {
1046 // TODO(NODE-3485): Replace with MongoChangeStreamClosedError
1047 throw new MongoAPIError(CHANGESTREAM_CLOSED_ERROR);
1048 }
1049
1050 if (
1051 cursorInitialized &&
1052 (isResumableError(changeStreamError, this.cursor.maxWireVersion) ||
1053 changeStreamError instanceof MongoOperationTimeoutError)
1054 ) {
1055 try {
1056 await this.cursor.close();
1057 } catch (error) {
1058 squashError(error);
1059 }
1060
1061 await this._resume(changeStreamError);
1062
1063 if (changeStreamError instanceof MongoOperationTimeoutError) throw changeStreamError;
1064 } else {
1065 try {
1066 await this.close();
1067 } catch (error) {
1068 squashError(error);
1069 }
1070
1071 throw changeStreamError;
1072 }
1073 }
1074
1075 private async _resume(changeStreamError: AnyError) {
1076 this.timeoutContext?.refresh();

Callers 3

hasNextMethod · 0.95
nextMethod · 0.95
tryNextMethod · 0.95

Calls 4

closeMethod · 0.95
_resumeMethod · 0.95
isResumableErrorFunction · 0.90
squashErrorFunction · 0.90

Tested by

no test coverage detected