Thursday, April 21, 2011

How to print a stack trace in NodeJS?

Does anyone know how to print a stack trace in nodejs?

From stackoverflow
  • http://github.com/emwendelin/javascript-stacktrace This looks promising.

  • Any Error object has a stack member that traps the point at which it was constructed.

    var stack = new Error().stack
    require("sys").puts( stack )
    
    sirhc : or just `sys.puts(new Error().stack)` (after adding the system module)

0 comments:

Post a Comment