Saturday, 27 May 2017

Restart the process after uncaughtException in Express Js Server

I have express js server and i have handle the uncaughtException with the below code.

process.on('uncaughtException', function (error) {
     console.log(error.stack);
});

Once if uncaught exception throws it will show the error and below error message will be showing infinitely instead of restart the process. this issue will be exist in the forever start as well. below is the error after uncaught exception

[5]: Error: bind EACCES undefined
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at cb (net.js:1323:16)
    at rr (cluster.js:625:14)
    at Worker.<anonymous> (cluster.js:594:9)
    at process.<anonymous> (cluster.js:765:8)
    at emitTwo (events.js:111:20)
    at process.emit (events.js:191:7)
    at process.nextTick (internal/child_process.js:753:12)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

This will be print continuously on the console after exception throws. please help me to restart the process after uncaught exception throws.



via sameera danthanarayana

No comments:

Post a Comment