From e35c9e9fc5eb3bb344f9e9103e397e9a2660ff2b Mon Sep 17 00:00:00 2001 From: Jon Heller Date: Mon, 19 Oct 2015 00:57:33 -0400 Subject: [PATCH] catch empty rss results, fix catching of bad feed options --- js/news/news.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/news/news.js b/js/news/news.js index 3b29a457..a1cb756f 100644 --- a/js/news/news.js +++ b/js/news/news.js @@ -45,7 +45,11 @@ news.fetchFeed = function (yqUrl) { url: yqUrl, success: function (data) { - this.parseFeed(data.query.results.item); + if (data.query.count > 0) { + this.parseFeed(data.query.results.item); + } else { + console.error('No feed results for: ' + yqUrl); + } }.bind(this), error: function () { @@ -85,7 +89,7 @@ news.showNews = function () { setTimeout(function () { this.showNews(); - }.bind(this), 30000); + }.bind(this), 3000); } else if (this.newsItems.length === 0 && this.seenNewsItem.length !== 0) { this.newsItems = this.seenNewsItem.splice(0); @@ -103,7 +107,7 @@ news.showNews = function () { news.init = function () { - if (this.feed === null || this.feed instanceof Array) { + if (this.feed === null || (this.feed instanceof Array === false && typeof this.feed !== 'string')) { return false; } else if (typeof this.feed === 'string') { this.feed = [this.feed];