Gracefully fail if sqlite3 module fails to load

This commit is contained in:
Pavel Djundik 2018-04-26 12:11:38 +03:00
parent 4f85779e78
commit 0ad9def514

View File

@ -2,10 +2,19 @@
const path = require("path");
const fsextra = require("fs-extra");
const sqlite3 = require("sqlite3");
const Helper = require("../helper");
const Msg = require("../models/msg");
let sqlite3;
try {
sqlite3 = require("sqlite3");
} catch (e) {
Helper.config.messageStorage = Helper.config.messageStorage.filter((item) => item !== "sqlite");
log.error("Unable to load sqlite3 module. You might need to install it manually.");
}
const currentSchemaVersion = 1520239200;
const schema = [