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

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -