catch empty rss results, fix catching of bad feed options

This commit is contained in:
Jon Heller 2015-10-19 00:57:33 -04:00
parent 859b7591fc
commit e35c9e9fc5

View File

@ -45,7 +45,11 @@ news.fetchFeed = function (yqUrl) {
url: yqUrl, url: yqUrl,
success: function (data) { 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), }.bind(this),
error: function () { error: function () {
@ -85,7 +89,7 @@ news.showNews = function () {
setTimeout(function () { setTimeout(function () {
this.showNews(); this.showNews();
}.bind(this), 30000); }.bind(this), 3000);
} else if (this.newsItems.length === 0 && this.seenNewsItem.length !== 0) { } else if (this.newsItems.length === 0 && this.seenNewsItem.length !== 0) {
this.newsItems = this.seenNewsItem.splice(0); this.newsItems = this.seenNewsItem.splice(0);
@ -103,7 +107,7 @@ news.showNews = function () {
news.init = 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; return false;
} else if (typeof this.feed === 'string') { } else if (typeof this.feed === 'string') {
this.feed = [this.feed]; this.feed = [this.feed];