Skip to content

Commit

Permalink
fix(NODE-5985): throw Nodejs' certificate expired error when TLS fail…
Browse files Browse the repository at this point in the history
…s to connect instead of `CERT_HAS_EXPIRED` (#4014)
  • Loading branch information
baileympearson authored Mar 5, 2024
1 parent 7eaf2c8 commit 057c223
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/cmap/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ export async function makeSocket(options: MakeConnectionOptions): Promise<Stream
const useTLS = options.tls ?? false;
const noDelay = options.noDelay ?? true;
const connectTimeoutMS = options.connectTimeoutMS ?? 30000;
const rejectUnauthorized = options.rejectUnauthorized ?? true;
const existingSocket = options.existingSocket;

let socket: Stream;
Expand Down Expand Up @@ -375,10 +374,6 @@ export async function makeSocket(options: MakeConnectionOptions): Promise<Stream
return socket;
} catch (error) {
socket.destroy();
if ('authorizationError' in socket && socket.authorizationError != null && rejectUnauthorized) {
// TODO(NODE-5192): wrap this with a MongoError subclass
throw socket.authorizationError;
}
throw error;
} finally {
socket.setTimeout(0);
Expand Down

0 comments on commit 057c223

Please sign in to comment.