Node.js process on('uncaughtException')

Description

Node.js process on('uncaughtException')


function showRunning(){  
    function exceptionHandler(err){  
        console.log('Caught exception: ' + err);  
        process.removeListener('uncaughtException', exceptionHandler);  
    }  /*from   w w  w .  j av a  2 s  .  co  m*/
    setTimeout(showRunning, 1000);  

    process.on('uncaughtException', exceptionHandler);  

    console.log("Still Running");  
    throw new Error("Yikes");
    console.log("Afrer Running");  

    process.removeListener('uncaughtException', exceptionHandler);  
}  

showRunning();



PreviousNext

Related