Added uncaughtException event

This commit is contained in:
Christer Warén 2021-09-06 22:35:49 +03:00
parent 984e8aab76
commit ab950352fa
2 changed files with 11 additions and 0 deletions

View File

@ -85,6 +85,10 @@ class RadioClient extends Client {
process.on('SIGTERM', () => {
require(`${events}SIGTERM`).execute(this);
});
process.on('uncaughtException', (error) => {
require(`${events}uncaughtException`).execute(this, error);
});
this.on("error", error => {
console.error(error);

View File

@ -0,0 +1,7 @@
module.exports = {
name: 'uncaughtException',
execute(client, error) {
console.log(error.stack);
process.emit('SIGINT');
}
}