Changeset

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 3280:645c4f14e03d
children 3282:9346ed926842
files mod_pubsub_feeds/mod_pubsub_feeds.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_feeds/mod_pubsub_feeds.lua	Sat Aug 25 14:25:30 2018 +0200
+++ b/mod_pubsub_feeds/mod_pubsub_feeds.lua	Sat Aug 25 14:28:15 2018 +0200
@@ -78,7 +78,12 @@
 function update_entry(item)
 	local node = item.node;
 	module:log("debug", "parsing %d bytes of data in node %s", #item.data or 0, node)
-	local feed = parse_feed(item.data);
+	local feed, err = parse_feed(item.data);
+	if not feed then
+		module:log("error", "Could not parse feed %q: %s", item.url, err);
+		module:log("debug", "Feed data:\n%s\n.", item.data);
+		return;
+	end
 	local entries = {};
 	for entry in feed:childtags("entry") do
 		table.insert(entries, entry);