Skip to content

Commit

Permalink
feat: print attempted addresses on ConnectTimeoutError (nodejs#2494)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored and crysmags committed Feb 27, 2024
1 parent a201acd commit cafa798
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 cafa798

Please sign in to comment.