lucasgonze / Safeharbor.in

2 stars 0 forks source link

Effective "Emergency" measures #236

Open lucasgonze opened 11 years ago

lucasgonze commented 11 years ago

There are always plenty of places for fatal errors. We need a function that can be called to handle meltdowns. This would page/email/call/notify site admins.

It would go in emergency.js.

lucasgonze commented 11 years ago

This is actually a good place for exceptions in Node.js.

Catch here:

    process.on('uncaughtException', function (err) {
        // by the time you get to this point
        // the session is screwed. The app will
        // continue to run for other users and
        // this user can use browser's 'back' to
        // unhork. 
        // TODO: notify admin when this happens...
        console.log(['******* Caught-uncaught exception: ', err] );
        console.log( err.stack );
        console.trace('call stack:');
        });