Skip to content

Commit 3ad46f4

Browse files
committed
add correct then handler
1 parent 8efaee4 commit 3ad46f4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/change_stream.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -938,10 +938,12 @@ export class ChangeStream<
938938
.selectServer(this.cursor.readPreference, {
939939
operationName: 'reconnect topology in change stream'
940940
})
941-
.catch(serverSelectionError => {
942-
if (serverSelectionError) return this._closeEmitterModeWithError(changeStreamError);
943-
this.cursor = this._createChangeStreamCursor(this.cursor.resumeOptions);
944-
});
941+
.then(
942+
() => {
943+
this.cursor = this._createChangeStreamCursor(this.cursor.resumeOptions);
944+
},
945+
() => this._closeEmitterModeWithError(changeStreamError)
946+
);
945947
} else {
946948
this._closeEmitterModeWithError(changeStreamError);
947949
}

0 commit comments

Comments
 (0)