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 { errorMessage, isDiscordAPIError, isDiscordHTTPError, SECONDS, successMessage } from "./utils";
|
||||||
import { loadYamlSafely } from "./utils/loadYamlSafely";
|
import { loadYamlSafely } from "./utils/loadYamlSafely";
|
||||||
import { DecayingCounter } from "./utils/DecayingCounter";
|
import { DecayingCounter } from "./utils/DecayingCounter";
|
||||||
|
import { PluginNotLoadedError } from "knub/dist/plugins/PluginNotLoadedError";
|
||||||
|
|
||||||
if (!process.env.KEY) {
|
if (!process.env.KEY) {
|
||||||
// tslint:disable-next-line:no-console
|
// tslint:disable-next-line:no-console
|
||||||
|
@ -106,6 +107,13 @@ function errorHandler(err) {
|
||||||
return;
|
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
|
// tslint:disable:no-console
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue