Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
matteosb committed Sep 11, 2024
1 parent 0c2a99a commit c8a2f9c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ const createUdpTransport = args => {
}
});
} else {
socket.send(buf, 0, buf.length, args.port, dnsResolutionData.resolvedAddress, callback);
try {
socket.send(buf, 0, buf.length, args.port, dnsResolutionData.resolvedAddress, callback);
} catch (socketError) {
callback(socketError);
}
}
};

Expand All @@ -82,7 +86,11 @@ const createUdpTransport = args => {
if (args.cacheDns) {
sendUsingDnsCache(callback, buf);
} else {
socket.send(buf, 0, buf.length, args.port, args.host, callback);
try {
socket.send(buf, 0, buf.length, args.port, args.host, callback);
} catch (socketError) {
callback(socketError);
}
}
},
close: socket.close.bind(socket),
Expand Down

0 comments on commit c8a2f9c

Please sign in to comment.