@internal
(changeStreamError: AnyError, cursorInitialized: boolean)
| 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) { |
no test coverage detected