node.js - How to prevent nodejs console close -
is there alternative php error_reporting(0)
in nodejs? want prevent app closing after error, tried try , catch method
, doesn't work. so, how can prevent node.js server
closing after error ?
edit: there event uncaught errors:
process.on('uncaughtexception', function (err) { console.log('caught exception: ' + err); });
see duplicate: make node.js not exit on error
you use pm2
run script, pm2
automatically restart script on crash.
you need catch error. example
try { error(); } catch(err) { // nothing }
there no other way far know. fix or catch these errors only.
Comments
Post a Comment