Handle plugin load errors gracefully
This commit is contained in:
parent
fcc3c17b73
commit
557898e484
4 changed files with 38 additions and 18 deletions
|
@ -21,6 +21,7 @@ import { GuildLogs } from "./data/GuildLogs";
|
|||
import { LogType } from "./data/LogType";
|
||||
import { ZeppelinPlugin } from "./plugins/ZeppelinPlugin";
|
||||
import { logger } from "./logger";
|
||||
import { PluginLoadError } from "knub/dist/plugins/PluginLoadError";
|
||||
|
||||
const fsp = fs.promises;
|
||||
|
||||
|
@ -59,6 +60,12 @@ if (process.env.NODE_ENV === "production") {
|
|||
return;
|
||||
}
|
||||
|
||||
if (err instanceof PluginLoadError) {
|
||||
// tslint:disable:no-console
|
||||
console.warn(`${err.guild.name} (${err.guild.id}): Failed to load plugin '${err.pluginName}': ${err.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// tslint:disable:no-console
|
||||
console.error(err);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue