.
This commit is contained in:
parent
d51ac60e14
commit
67730845a5
2 changed files with 26 additions and 1 deletions
24
index.js
24
index.js
|
@ -4,6 +4,30 @@ client.config = require('./config.js').settings;
|
||||||
const MapDB = require('quickmap.db');
|
const MapDB = require('quickmap.db');
|
||||||
const db = new MapDB('database.json');
|
const db = new MapDB('database.json');
|
||||||
|
|
||||||
|
const chalk = require('chalk')
|
||||||
|
|
||||||
|
function catchError(message, err, origin, reason) {
|
||||||
|
console.log(chalk.gray('—————————————————————————————————'));
|
||||||
|
console.log(
|
||||||
|
chalk.white('['),
|
||||||
|
chalk.red.bold('AntiCrash'),
|
||||||
|
chalk.white(']'),
|
||||||
|
chalk.gray(' : '),
|
||||||
|
chalk.white.bold(message),
|
||||||
|
);
|
||||||
|
console.log(chalk.gray('—————————————————————————————————'));
|
||||||
|
console.log(err, origin, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
process.on('unhandledRejection', (err, origin) => {
|
||||||
|
catchError('Unhandled Rejection/Catch', err, origin);
|
||||||
|
});
|
||||||
|
process.on('uncaughtException', (err, origin) => {
|
||||||
|
catchError('Uncaught Exception/Catch', err, origin);
|
||||||
|
});
|
||||||
|
process.on('multipleResolves', (type, promise, reason) => {
|
||||||
|
catchError('Multiple Resolves', type, promise, reason);
|
||||||
|
});
|
||||||
|
|
||||||
async function setup() {
|
async function setup() {
|
||||||
var isset = await db.get('client.issetupped')
|
var isset = await db.get('client.issetupped')
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.1",
|
"express": "^4.18.1",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
"quickmap.db": "^1.1.1"
|
"quickmap.db": "^1.0.6",
|
||||||
|
"chalk": "^4.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue