move process error listener to logger

This commit is contained in:
Erik 2020-08-13 23:44:58 +03:00
parent 82d3b9392b
commit 6d2d1fec72
2 changed files with 6 additions and 6 deletions

View File

@ -2,8 +2,4 @@ const Manager = require('./Manager.js');
const options = require('./options.json'); const options = require('./options.json');
new Manager(options) new Manager(options)
.build(); .build();
process.on("unhandledRejection", (error) => {
console.error("Unhandled promise rejection:", error); //eslint-disable-line no-console
});

View File

@ -39,7 +39,11 @@ class Logger {
//TODO: Add proper date-oriented filenames and add a daily rotation file (?). //TODO: Add proper date-oriented filenames and add a daily rotation file (?).
this.shardManager this.shardManager
.on('shardCreate', (shard) => this.write('debug', "Shard created.", shard)); .on('shardCreate', (shard) => this.write('info', "Shard created.", shard));
process.on("unhandledRejection", (error) => {
this.write('error', `Unhandled promise rejection:\n${error.stack}`); //eslint-disable-line no-console
});
} }