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

Method _processErrorStreamMode

src/change_stream.ts:1011–1041  ·  view source on GitHub ↗

@internal

(changeStreamError: AnyError, cursorInitialized: boolean)

Source from the content-addressed store, hash-verified

1009
1010 /** @internal */
1011 private _processErrorStreamMode(changeStreamError: AnyError, cursorInitialized: boolean) {
1012 // If the change stream has been closed explicitly, do not process error.
1013 if (this.isClosed) return;
1014
1015 if (
1016 cursorInitialized &&
1017 (isResumableError(changeStreamError, this.cursor.maxWireVersion) ||
1018 changeStreamError instanceof MongoOperationTimeoutError)
1019 ) {
1020 this._endStream();
1021
1022 this.cursor
1023 .close()
1024 .then(
1025 () => this._resume(changeStreamError),
1026 e => {
1027 squashError(e);
1028 return this._resume(changeStreamError);
1029 }
1030 )
1031 .then(
1032 () => {
1033 if (changeStreamError instanceof MongoOperationTimeoutError)
1034 this.emit(ChangeStream.ERROR, changeStreamError);
1035 },
1036 () => this._closeEmitterModeWithError(changeStreamError)
1037 );
1038 } else {
1039 this._closeEmitterModeWithError(changeStreamError);
1040 }
1041 }
1042
1043 /** @internal */
1044 private async _processErrorIteratorMode(changeStreamError: AnyError, cursorInitialized: boolean) {

Callers 1

_streamEventsMethod · 0.95

Calls 7

_endStreamMethod · 0.95
_resumeMethod · 0.95
isResumableErrorFunction · 0.90
squashErrorFunction · 0.90
emitMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected