Tidy up some feed error spam
This commit is contained in:
parent
987473ffa6
commit
18f300d46d
|
@ -1,6 +1,8 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
### Updated
|
||||||
|
- Tidy up some console spam
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix bot crash if feed article contains link with invalid host name
|
- 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...)
|
- Temporary fix for bot crash if used with a feed without links in the articles (didn't realise this was possible...)
|
||||||
|
|
|
@ -54,7 +54,7 @@ module.exports = class FeedData {
|
||||||
fetchLatest(guild) {
|
fetchLatest(guild) {
|
||||||
Dns.resolve(Url.parse(this.url).host || "", err => {
|
Dns.resolve(Url.parse(this.url).host || "", err => {
|
||||||
if (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
|
else
|
||||||
this._doFetchRSS(guild);
|
this._doFetchRSS(guild);
|
||||||
});
|
});
|
||||||
|
@ -67,12 +67,8 @@ module.exports = class FeedData {
|
||||||
|
|
||||||
_doFetchRSS(guild) {
|
_doFetchRSS(guild) {
|
||||||
FeedRead(this.url, (err, articles) => {
|
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) {
|
|
||||||
if (err.message !== "Body is not RSS or ATOM")
|
|
||||||
DiscordUtil.dateError("Error reading RSS feed: " + (err.message || err));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (articles.length > 0 && articles[0].link) {
|
if (articles.length > 0 && articles[0].link) {
|
||||||
|
|
||||||
|
@ -85,7 +81,7 @@ module.exports = class FeedData {
|
||||||
role = guild.roles.get(this.roleID);
|
role = guild.roles.get(this.roleID);
|
||||||
|
|
||||||
channel.send((role || "") + formatPost(articles[0]))
|
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}`));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,6 +30,10 @@ function dateError(...args) {
|
||||||
doDateLog(Console.error, logWriter, args, "ERROR");
|
doDateLog(Console.error, logWriter, args, "ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dateDebugError(...args) {
|
||||||
|
doDateLog(null, null, args, "DEBUG ERROR");
|
||||||
|
}
|
||||||
|
|
||||||
function dateDebug(...args) {
|
function dateDebug(...args) {
|
||||||
doDateLog(null, null, args, "DEBUG");
|
doDateLog(null, null, args, "DEBUG");
|
||||||
}
|
}
|
||||||
|
@ -58,5 +62,6 @@ module.exports = {
|
||||||
dateError,
|
dateError,
|
||||||
dateLog,
|
dateLog,
|
||||||
dateDebug,
|
dateDebug,
|
||||||
|
dateDebugError,
|
||||||
ask
|
ask
|
||||||
};
|
};
|
Loading…
Reference in a new issue