mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Add try/catch to WOL node to try to grab socket error.
(Upstream fix requested).
This commit is contained in:
parent
0a15d2d539
commit
661a50b123
@ -28,9 +28,14 @@ module.exports = function(RED) {
|
|||||||
var mac = this.mac || msg.mac || null;
|
var mac = this.mac || msg.mac || null;
|
||||||
if (mac != null) {
|
if (mac != null) {
|
||||||
if (chk.test(mac)) {
|
if (chk.test(mac)) {
|
||||||
wol.wake(mac, function(error) {
|
try {
|
||||||
if (error) { node.warn(error); }
|
wol.wake(mac, function(error) {
|
||||||
});
|
if (error) { node.warn(error); }
|
||||||
|
else if (RED.settings.verbose) {
|
||||||
|
node.log("sent WOL magic packet");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch(e) { if (RED.settings.verbose) { node.log("WOL: socket error"); }
|
||||||
}
|
}
|
||||||
else { node.warn('WOL: bad mac address "'+mac+'"'); }
|
else { node.warn('WOL: bad mac address "'+mac+'"'); }
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"version" : "0.0.2",
|
"version" : "0.0.2",
|
||||||
"description" : "A Node-RED node to send Wake-On-LAN (WOL) magic packets",
|
"description" : "A Node-RED node to send Wake-On-LAN (WOL) magic packets",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"wake_on_lan" : "0.0.3"
|
"wake_on_lan" : "0.0.4"
|
||||||
},
|
},
|
||||||
"repository" : {
|
"repository" : {
|
||||||
"type":"git",
|
"type":"git",
|
||||||
|
Loading…
Reference in New Issue
Block a user