diff --git a/src/Client.ts b/src/Client.ts index 4dc9611..761e7cd 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -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); diff --git a/src/client/events/uncaughtException.js b/src/client/events/uncaughtException.js new file mode 100644 index 0000000..5df8a0b --- /dev/null +++ b/src/client/events/uncaughtException.js @@ -0,0 +1,7 @@ +module.exports = { + name: 'uncaughtException', + execute(client, error) { + console.log(error.stack); + process.emit('SIGINT'); + } +} \ No newline at end of file