Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDarshan Sen <raisinten@gmail.com>2022-03-26 18:39:59 +0300
committerGitHub <noreply@github.com>2022-03-26 18:39:59 +0300
commitbc395d4c53afaaa53f9088b90ae84249adbf4d2e (patch)
treee581017fa3b67e3e4fd30dd9646fd177a9e2d44b /lib
parent99c46a62dae50e10f63e22f6becba99e56ffe975 (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.js8
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;