Skip to content

Instantly share code, notes, and snippets.

@qharlie
Created April 17, 2013 22:44
Show Gist options
  • Save qharlie/5408391 to your computer and use it in GitHub Desktop.
Save qharlie/5408391 to your computer and use it in GitHub Desktop.
process.on('uncaughtException', function (err) {
var stack = err.stack.replace(/^[^\(]+?[\n$]/gm, '')
.replace(/^\s+at\s+/gm, '')
.replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@')
.split('\n');
logger.log('Uncaught exception', stack);
// Email somebody
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment