Skip to content

Commit

Permalink
Clean up socketError function.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurschreiber committed Sep 19, 2024
1 parent 4f72e83 commit 5b74c93
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2384,12 +2384,10 @@ class Connection extends EventEmitter {
* @private
*/
socketError(error: Error) {
if (this.state === this.STATE.CONNECTING || this.state === this.STATE.SENT_TLSSSLNEGOTIATION) {
this.emit('connect', this.wrapSocketError(error));
} else {
this.emit('error', this.wrapSocketError(error));
}
this.dispatchEvent('socketError', error);
process.nextTick(() => {
this.emit('error', this.wrapSocketError(error));
});
}

/**
Expand Down

0 comments on commit 5b74c93

Please sign in to comment.