Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Colorful exception handler for Node.js with CoffeeScript support and improved nodemon/supervisor compatibility
CoffeeScript JavaScript
Tree: c7ddccc5ad

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
src
.gitignore
.npmignore
CHANGELOG.md
LICENSE
README.md
compile.bat
package.json
screenshot.png

README.md

ANSInception

Colorful exception handler for Node.js with CoffeeScript support and improved nodemon/supervisor compatibility

Screenshot

Features

  • Quits after a delay to prevent nodemon, supervisor, etc. from eating console.log output sent shortly before the exception was thrown
  • Shows up to five lines of code from each entry in the stack trace
  • Color codes the offending part of the code (based on the column number)
  • Compiles CoffeeScript to show the actual offending code (otherwise the line numbers don't make sense)
  • Highlights the file name in stack trace paths
  • Uses different colors depending on the location of the code (your code, local module, global module/node.js internals)

Unfortunately registering with 'uncaughtException' has no effect until the next tick. So in order to benefit from the exception handler right away, you need to postpone execution of your code. You can either do this manually or use the convience version (see below)

Usage with CoffeeScript

Short version:

require('ansinception') ->
    # Your code

Long version:

process.on 'uncaughtException', require 'ansinception'
process.nextTick ->
    # Your code

Usage with JavaScript

Short version:

require('ansinception')(function() {
    // Your code
});

Long version:

process.on('uncaughtException', require('ansinception'));
process.nextTick(function() {
    // Your code
});
Something went wrong with that request. Please try again.