3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +00:00

api: crash on unhandled rejections

This commit is contained in:
Dragory 2019-08-04 15:45:35 +03:00
parent 6043fd5cd3
commit a188b0433c

View file

@ -7,9 +7,19 @@ import { initArchives } from "./archives";
import { connect } from "../data/db";
import path from "path";
import { TokenError } from "passport-oauth2";
import { PluginError } from "knub";
require("dotenv").config({ path: path.resolve(__dirname, "..", "..", "api.env") });
function errorHandler(err) {
// tslint:disable:no-console
console.error(err.stack || err);
process.exit(1);
// tslint:enable:no-console
}
process.on("unhandledRejection", errorHandler);
console.log("Connecting to database...");
connect().then(() => {
const app = express();