node package manager

error-trap

Real-time Error Trap

This module automatically injects code into every HTML page that makes a WebSocket connection back to the server and sends the server information about any uncaught errors. It hooks into browser functionality such as addEventListener() and setTimeout() to get complete stack traces but falls back to a window.onerror handler so it doesn't miss anything.

Usage

var errorTrap = require('error-trap');
var connect = require('connect');
var app = connect();
var server = require('http').createServer(app);

app.use(errorTrap({
  server: server,
  onerror: function(message) {
    console.log({
      text: message.text,
      date: new Date(message.time),
      method: message.method
    });
  }
}));
app.use(connect.static('www'));
server.listen(8000);