Comparison

util/pubsub.lua @ 9207:76d593b35958

util.pubsub, pubsub.lib: Improve error on attempt to publish invalid item
author Matthew Wild <mwild1@gmail.com>
date Sat, 18 Aug 2018 15:26:35 +0100
parent 9206:33ee40dc3e25
child 9218:7e27dc4d100b
comparison
equal deleted inserted replaced
9206:33ee40dc3e25 9207:76d593b35958
507 node_obj = self.nodes[node]; 507 node_obj = self.nodes[node];
508 elseif required_config and not check_preconditions(node_obj.config, required_config) then 508 elseif required_config and not check_preconditions(node_obj.config, required_config) then
509 return false, "precondition-not-met"; 509 return false, "precondition-not-met";
510 end 510 end
511 if not self.config.itemcheck(item) then 511 if not self.config.itemcheck(item) then
512 return nil, "internal-server-error"; 512 return nil, "invalid-item";
513 end 513 end
514 local node_data = self.data[node]; 514 local node_data = self.data[node];
515 local ok = node_data:set(id, item); 515 local ok = node_data:set(id, item);
516 if not ok then 516 if not ok then
517 return nil, "internal-server-error"; 517 return nil, "internal-server-error";