File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -169,17 +169,14 @@ export async function performInitialHandshake(
169169
170170 try {
171171 await provider . auth ( authContext ) ;
172- } catch ( cause ) {
173- // If we encounter an error authenticating a connection, do NOT apply backpressure labels.
174-
175- const error =
176- cause instanceof MongoError
177- ? cause
178- : new MongoRuntimeError ( 'unexpected error during authentication' , cause ) ;
172+ } catch ( error ) {
173+ // NOTE: If we encounter an error authenticating a connection, do NOT apply backpressure labels.
179174
180- error . addErrorLabel ( MongoErrorLabel . HandshakeError ) ;
181- if ( needsRetryableWriteLabel ( error , response . maxWireVersion , conn . description . type ) ) {
182- error . addErrorLabel ( MongoErrorLabel . RetryableWriteError ) ;
175+ if ( error instanceof MongoError ) {
176+ error . addErrorLabel ( MongoErrorLabel . HandshakeError ) ;
177+ if ( needsRetryableWriteLabel ( error , response . maxWireVersion , conn . description . type ) ) {
178+ error . addErrorLabel ( MongoErrorLabel . RetryableWriteError ) ;
179+ }
183180 }
184181
185182 throw error ;
You can’t perform that action at this time.
0 commit comments