Skip to content

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

License

Notifications You must be signed in to change notification settings

DennisKehrig/ANSInception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (green: your code, yellow: local module, pink: 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 convenience 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
});

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published