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

add error msg to sort node

This commit is contained in:
Dave Conway-Jones 2017-12-05 15:01:58 +00:00
parent afce106186
commit 422fbcb0b7
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

View File

@ -79,11 +79,11 @@ module.exports = function(RED) {
return function(x, y) { return function(x, y) {
var xp = conv(key(x)); var xp = conv(key(x));
var yp = conv(key(y)); var yp = conv(key(y));
if (xp === yp) return 0; if (xp === yp) { return 0; }
if (xp > yp) return dir; if (xp > yp) { return dir; }
return -dir; return -dir;
}; };
}; }
function send_group(group) { function send_group(group) {
var key = key_is_payload var key = key_is_payload
@ -104,7 +104,7 @@ module.exports = function(RED) {
msg.parts.index = i; msg.parts.index = i;
node.send(msg); node.send(msg);
} }
}; }
function sort_payload(msg) { function sort_payload(msg) {
var payload = msg.payload; var payload = msg.payload;
@ -133,7 +133,7 @@ module.exports = function(RED) {
} }
return false; return false;
} }
function process_msg(msg) { function process_msg(msg) {
if (!msg.hasOwnProperty("parts")) { if (!msg.hasOwnProperty("parts")) {
if (sort_payload(msg)) { if (sort_payload(msg)) {
@ -168,10 +168,10 @@ module.exports = function(RED) {
if ((max_msgs > 0) && (pending_count > max_msgs)) { if ((max_msgs > 0) && (pending_count > max_msgs)) {
pending = {}; pending = {};
pending_count = 0; pending_count = 0;
node.error(RED._("sort.too-many")); node.error(RED._("sort.too-many"),msg);
} }
} }
this.on("input", function(msg) { this.on("input", function(msg) {
process_msg(msg); process_msg(msg);
}); });
@ -179,4 +179,3 @@ module.exports = function(RED) {
RED.nodes.registerType("sort", SortNode); RED.nodes.registerType("sort", SortNode);
} }