Show a nicer error in Chan.loadMessages() when network is misconfigured (#4476)
Show a nicer error in Chan.loadMessages() when network is misconfigured ie. an actual error message instead of crashing on a `null` value.
This commit is contained in:
parent
c12dd6c740
commit
66455f2c40
@ -241,6 +241,14 @@ Chan.prototype.loadMessages = function (client, network) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!network.irc) {
|
||||||
|
// Network created, but misconfigured
|
||||||
|
log.warn(
|
||||||
|
`Failed to load messages for ${client.name}, network ${network.name} is not initialized.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
client.messageProvider
|
client.messageProvider
|
||||||
.getMessages(network, this)
|
.getMessages(network, this)
|
||||||
.then((messages) => {
|
.then((messages) => {
|
||||||
@ -270,7 +278,7 @@ Chan.prototype.loadMessages = function (client, network) {
|
|||||||
requestZncPlayback(this, network, from);
|
requestZncPlayback(this, network, from);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => log.error(`Failed to load messages: ${err}`));
|
.catch((err) => log.error(`Failed to load messages for ${client.name}: ${err}`));
|
||||||
};
|
};
|
||||||
|
|
||||||
Chan.prototype.isLoggable = function () {
|
Chan.prototype.isLoggable = function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user