Skip to content

Commit e14a3ef

Browse files
fix kerberos tests
1 parent 7f54387 commit e14a3ef

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/cmap/connect.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)