Skip to content

Commit 057c223

Browse files
fix(NODE-5985): throw Nodejs' certificate expired error when TLS fails to connect instead of CERT_HAS_EXPIRED (#4014)
1 parent 7eaf2c8 commit 057c223

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

Diff for: src/cmap/connect.ts

-5
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ export async function makeSocket(options: MakeConnectionOptions): Promise<Stream
319319
const useTLS = options.tls ?? false;
320320
const noDelay = options.noDelay ?? true;
321321
const connectTimeoutMS = options.connectTimeoutMS ?? 30000;
322-
const rejectUnauthorized = options.rejectUnauthorized ?? true;
323322
const existingSocket = options.existingSocket;
324323

325324
let socket: Stream;
@@ -375,10 +374,6 @@ export async function makeSocket(options: MakeConnectionOptions): Promise<Stream
375374
return socket;
376375
} catch (error) {
377376
socket.destroy();
378-
if ('authorizationError' in socket && socket.authorizationError != null && rejectUnauthorized) {
379-
// TODO(NODE-5192): wrap this with a MongoError subclass
380-
throw socket.authorizationError;
381-
}
382377
throw error;
383378
} finally {
384379
socket.setTimeout(0);

0 commit comments

Comments
 (0)