1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

On error sending pushover message throw a catchable exception (#653)

* On error throw a catchable 

Throws an catchable exception if there is any error in sending the message. So you can react to it with a catch node

* Updated errorhandling

Updated the error handling process to be in compliance with the Node-RED Api
This commit is contained in:
JsBergbau 2020-05-20 13:04:42 +00:00 committed by GitHub
parent 05a9312905
commit d4d2404578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,16 +91,16 @@ module.exports = function(RED) {
node.error("[57-pushover.js] Error: attachment property must be a path to a local file or a Buffer containing an image");
return;
}
pushMessage(pushmsg);
pushMessage(pushmsg,msg);
}
else {
node.warn("Pushover credentials not set.");
}
});
function pushMessage(pushmsg) {
function pushMessage(pushmsg,msg) {
pusher.send( pushmsg, function(err, response) {
if (err) { node.error(err); }
if (err) { node.error(err,msg); }
else {
try {
response = JSON.parse(response);