data: do not crash if the response file is bad

This commit is contained in:
liushuyu 2020-05-24 00:21:40 -06:00
parent 2f72dc23fc
commit 354074089d
1 changed files with 6 additions and 2 deletions

View File

@ -32,8 +32,12 @@ export function readBans () {
export function readCustomResponses () { export function readCustomResponses () {
// Load the responses file into the responses variable. // Load the responses file into the responses variable.
state.responses = require(`./responses/${process.env.TENANT}.json`); try {
logger.debug(`Loaded responses file for ${process.env.TENANT} from external source.`); state.responses = require(`./responses/${process.env.TENANT}.json`);
logger.debug(`Loaded responses file for ${process.env.TENANT} from external source.`);
} catch (e) {
logger.error(`Failed to load ${process.env.TENANT}.json! Custom responses are disabled.`);
}
} }
export function flushWarnings () { export function flushWarnings () {