Don't crash on PluginNotLoadedError
This commit is contained in:
parent
4878589786
commit
d0139f6c2e
1 changed files with 8 additions and 0 deletions
|
@ -20,6 +20,7 @@ import { startUptimeCounter } from "./uptime";
|
|||
import { errorMessage, isDiscordAPIError, isDiscordHTTPError, SECONDS, successMessage } from "./utils";
|
||||
import { loadYamlSafely } from "./utils/loadYamlSafely";
|
||||
import { DecayingCounter } from "./utils/DecayingCounter";
|
||||
import { PluginNotLoadedError } from "knub/dist/plugins/PluginNotLoadedError";
|
||||
|
||||
if (!process.env.KEY) {
|
||||
// tslint:disable-next-line:no-console
|
||||
|
@ -106,6 +107,13 @@ function errorHandler(err) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (err instanceof PluginNotLoadedError) {
|
||||
// We don't want to crash the bot here, although this *should not happen*
|
||||
// TODO: Proper system for preventing plugin load/unload race conditions
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// tslint:disable:no-console
|
||||
console.error(err);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue