Skip to content

Commit

Permalink
catch err
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyAkintunde committed Jul 6, 2024
1 parent 28cad01 commit 8a146c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,11 @@ const {PORT} = require('./set.js');

start(PORT);

const restart = () => {
const {exec} = require("child_process");
console.log(`Restarting`)
exec("pm2 restart all");
}

//catch exections
process.on('uncaughtException', function (err) {
Expand All @@ -1071,5 +1076,8 @@ if (e.includes("rate-overlimit")) return
if (e.includes("Connection Closed")) return
if (e.includes("Timed Out")) return
if (e.includes("Value not found")) return
console.log('Caught exception: ', err)
if (e.includes("Authentication timed out")) restart()
console.log('Caught exception: ', err);
});


0 comments on commit 8a146c8

Please sign in to comment.