diff --git a/lib/dgram.js b/lib/dgram.js index 2e8071ca121..ee239558199 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -260,7 +260,9 @@ Socket.prototype.addMembership = function(multicastAddress, throw new Error('multicast address must be specified'); } - return this._handle.addMembership(multicastAddress, interfaceAddress); + if (this._handle.addMembership(multicastAddress, interfaceAddress)) { + throw new errnoException(errno, 'addMembership'); + } }; @@ -272,7 +274,9 @@ Socket.prototype.dropMembership = function(multicastAddress, throw new Error('multicast address must be specified'); } - return this._handle.dropMembership(multicastAddress, interfaceAddress); + if (this._handle.dropMembership(multicastAddress, interfaceAddress)) { + throw new errnoException(errno, 'dropMembership'); + } };