Skip to content

Commit

Permalink
feat: print attempted addresses on ConnectTimeoutError
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Dec 3, 2023
1 parent 8535d8c commit f8f5eb6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/core/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ function setupTimeout (onConnectTimeout, timeout) {
}

function onConnectTimeout (socket) {
util.destroy(socket, new ConnectTimeoutError())
let message = 'Connect Timeout Error'
if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) {
message = +` (attempted addresses: ${socket.autoSelectFamilyAttemptedAddresses.join(', ')})`
}
util.destroy(socket, new ConnectTimeoutError(message))
}

module.exports = buildConnector

0 comments on commit f8f5eb6

Please sign in to comment.