diff --git a/CHANGELOG.md b/CHANGELOG.md index 68f64f8..5c1f2b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## Unreleased +### Updated +- Tidy up some console spam ### Fixed - Fix bot crash if feed article contains link with invalid host name - Temporary fix for bot crash if used with a feed without links in the articles (didn't realise this was possible...) diff --git a/app/models/feed-data.js b/app/models/feed-data.js index 4fc5c18..009b3b0 100644 --- a/app/models/feed-data.js +++ b/app/models/feed-data.js @@ -54,7 +54,7 @@ module.exports = class FeedData { fetchLatest(guild) { Dns.resolve(Url.parse(this.url).host || "", err => { if (err) - DiscordUtil.dateError("Connection Error: Can't resolve host", err.message || err); + DiscordUtil.dateDebugError("Connection Error: Can't resolve host", err.message || err); else this._doFetchRSS(guild); }); @@ -67,12 +67,8 @@ module.exports = class FeedData { _doFetchRSS(guild) { FeedRead(this.url, (err, articles) => { - //filter out "Body is not RSS or ATOM" errors because these seem to happen rather frequently - if (err) { - if (err.message !== "Body is not RSS or ATOM") - DiscordUtil.dateError("Error reading RSS feed: " + (err.message || err)); + if (err) return; - } if (articles.length > 0 && articles[0].link) { @@ -85,7 +81,7 @@ module.exports = class FeedData { role = guild.roles.get(this.roleID); channel.send((role || "") + formatPost(articles[0])) - .catch(err => DiscordUtil.dateError(`Error posting in ${channel.id}: ${err.message || err}`)); + .catch(err => DiscordUtil.dateDebugError(`Error posting in ${channel.id}: ${err.message || err}`)); } } }); diff --git a/discord-bot-core/Util.js b/discord-bot-core/Util.js index 61e3f94..b56b9c3 100644 --- a/discord-bot-core/Util.js +++ b/discord-bot-core/Util.js @@ -30,6 +30,10 @@ function dateError(...args) { doDateLog(Console.error, logWriter, args, "ERROR"); } +function dateDebugError(...args) { + doDateLog(null, null, args, "DEBUG ERROR"); +} + function dateDebug(...args) { doDateLog(null, null, args, "DEBUG"); } @@ -58,5 +62,6 @@ module.exports = { dateError, dateLog, dateDebug, + dateDebugError, ask }; \ No newline at end of file