Merge pull request #2391 from thelounge/xpaw/no-sqlite-crash

Gracefully fail if sqlite3 module fails to load
This commit is contained in:
Pavel Djundik 2018-05-13 17:04:22 +03:00 committed by GitHub
commit d22f0344ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,10 +2,19 @@
const path = require("path"); const path = require("path");
const fsextra = require("fs-extra"); const fsextra = require("fs-extra");
const sqlite3 = require("sqlite3");
const Helper = require("../helper"); const Helper = require("../helper");
const Msg = require("../models/msg"); 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 currentSchemaVersion = 1520239200;
const schema = [ const schema = [