comparison mod_pubsub_feeds/mod_pubsub_feeds.lua @ 3281:27cc66bf918b

mod_pubsub_feeds: Handle feed parsing error (thanks apollo13)
author Kim Alvefur <zash@zash.se>
date Sat, 25 Aug 2018 14:28:15 +0200
parents 645c4f14e03d
children 281a864e7472
comparison
equal deleted inserted replaced
3280:645c4f14e03d 3281:27cc66bf918b
76 end 76 end
77 77
78 function update_entry(item) 78 function update_entry(item)
79 local node = item.node; 79 local node = item.node;
80 module:log("debug", "parsing %d bytes of data in node %s", #item.data or 0, node) 80 module:log("debug", "parsing %d bytes of data in node %s", #item.data or 0, node)
81 local feed = parse_feed(item.data); 81 local feed, err = parse_feed(item.data);
82 if not feed then
83 module:log("error", "Could not parse feed %q: %s", item.url, err);
84 module:log("debug", "Feed data:\n%s\n.", item.data);
85 return;
86 end
82 local entries = {}; 87 local entries = {};
83 for entry in feed:childtags("entry") do 88 for entry in feed:childtags("entry") do
84 table.insert(entries, entry); 89 table.insert(entries, entry);
85 end 90 end
86 local ok, items = pubsub.service:get_items(node, true); 91 local ok, items = pubsub.service:get_items(node, true);