diff options
author | Darshan Sen <raisinten@gmail.com> | 2022-03-26 18:39:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-26 18:39:59 +0300 |
commit | bc395d4c53afaaa53f9088b90ae84249adbf4d2e (patch) | |
tree | e581017fa3b67e3e4fd30dd9646fd177a9e2d44b /lib | |
parent | 99c46a62dae50e10f63e22f6becba99e56ffe975 (diff) |
src: properly report exceptions from AddressToJS()
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/42054
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dgram.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/dgram.js b/lib/dgram.js index 221afcf5bb0..5dbc2f22dab 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -159,7 +159,7 @@ function startListening(socket) { const state = socket[kStateSymbol]; state.handle.onmessage = onMessage; - // Todo: handle errors + state.handle.onerror = onError; state.handle.recvStart(); state.receiving = true; state.bindState = BIND_STATE_BOUND; @@ -923,6 +923,12 @@ function onMessage(nread, handle, buf, rinfo) { } +function onError(nread, handle, error) { + const self = handle[owner_symbol]; + return self.emit('error', error); +} + + Socket.prototype.ref = function() { const handle = this[kStateSymbol].handle; |