File tree Expand file tree Collapse file tree 5 files changed +8
-30
lines changed Expand file tree Collapse file tree 5 files changed +8
-30
lines changed Original file line number Diff line number Diff line change @@ -894,10 +894,7 @@ export class ChangeStream<
894
894
895
895
if ( isResumableError ( changeStreamError , this . cursor . maxWireVersion ) ) {
896
896
this . _endStream ( ) ;
897
- this . cursor . close ( ) . then (
898
- ( ) => null ,
899
- ( ) => null
900
- ) ; // Ignoring the result of close is intentional
897
+ this . cursor . close ( ) . catch ( ( ) => null ) ;
901
898
902
899
const topology = getTopology ( this . parent ) ;
903
900
topology . selectServer ( this . cursor . readPreference , { } , serverSelectionError => {
@@ -927,10 +924,7 @@ export class ChangeStream<
927
924
}
928
925
929
926
if ( isResumableError ( changeStreamError , this . cursor . maxWireVersion ) ) {
930
- this . cursor . close ( ) . then (
931
- ( ) => null ,
932
- ( ) => null
933
- ) ; // Ignoring the result of close is intentional
927
+ this . cursor . close ( ) . catch ( ( ) => null ) ;
934
928
935
929
const topology = getTopology ( this . parent ) ;
936
930
topology . selectServer ( this . cursor . readPreference , { } , serverSelectionError => {
Original file line number Diff line number Diff line change @@ -597,7 +597,7 @@ export abstract class AbstractCursor<
597
597
// We only want to end this session if we created it, and it hasn't ended yet
598
598
if ( session . explicit === false ) {
599
599
if ( ! session . hasEnded ) {
600
- session . endSession ( ( ) => null ) ;
600
+ session . endSession ( ) . catch ( ( ) => null ) ;
601
601
}
602
602
this [ kSession ] = this . client . startSession ( { owner : this , explicit : false } ) ;
603
603
}
@@ -883,10 +883,7 @@ class ReadableCursorStream extends Readable {
883
883
// a client during iteration. Alternatively, we could do the "right" thing and
884
884
// propagate the error message by removing this special case.
885
885
if ( err . message . match ( / s e r v e r i s c l o s e d / ) ) {
886
- this . _cursor . close ( ) . then (
887
- ( ) => null ,
888
- ( ) => null
889
- ) ; // Ignoring the result of close is intentional
886
+ this . _cursor . close ( ) . catch ( ( ) => null ) ;
890
887
return this . push ( null ) ;
891
888
}
892
889
@@ -905,10 +902,7 @@ class ReadableCursorStream extends Readable {
905
902
if ( result == null ) {
906
903
this . push ( null ) ;
907
904
} else if ( this . destroyed ) {
908
- this . _cursor . close ( ) . then (
909
- ( ) => null ,
910
- ( ) => null
911
- ) ; // Ignoring the result of close is intentional
905
+ this . _cursor . close ( ) . catch ( ( ) => null ) ;
912
906
} else {
913
907
if ( this . push ( result ) ) {
914
908
return this . _readNext ( ) ;
Original file line number Diff line number Diff line change @@ -493,7 +493,6 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
493
493
{ endSessions } ,
494
494
{ readPreference : ReadPreference . primaryPreferred , noResponse : true }
495
495
)
496
- . then ( ( ) => null ) // outcome does not matter
497
496
. catch ( ( ) => null ) ; // outcome does not matter
498
497
} )
499
498
. then ( ( ) => {
@@ -639,10 +638,7 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
639
638
// Do not return the result of callback
640
639
} )
641
640
. finally ( ( ) => {
642
- session . endSession ( ) . then (
643
- ( ) => null ,
644
- ( ) => null
645
- ) ;
641
+ session . endSession ( ) . catch ( ( ) => null ) ;
646
642
} ) ;
647
643
}
648
644
Original file line number Diff line number Diff line change @@ -144,10 +144,7 @@ export function executeOperation<
144
144
} ) ;
145
145
} catch ( error ) {
146
146
if ( session ?. owner != null && session . owner === owner ) {
147
- session . endSession ( ) . then (
148
- ( ) => null ,
149
- ( ) => null
150
- ) ; // Ignoring the result of endSession is intentional
147
+ session . endSession ( ) . catch ( ( ) => null ) ;
151
148
}
152
149
153
150
throw error ;
Original file line number Diff line number Diff line change @@ -616,10 +616,7 @@ function attemptTransaction<TSchema>(
616
616
}
617
617
618
618
if ( ! isPromiseLike ( promise ) ) {
619
- session . abortTransaction ( ) . then (
620
- ( ) => null ,
621
- ( ) => null
622
- ) ; // TODO(NODE-XXXX): is this correct?
619
+ session . abortTransaction ( ) . catch ( ( ) => null ) ;
623
620
throw new MongoInvalidArgumentError (
624
621
'Function provided to `withTransaction` must return a Promise'
625
622
) ;
You can’t perform that action at this time.
0 commit comments