Как вывести трассировку глубокого стека в node.js?

Когда возникает обычное исключение, выводится трассировка стека, подобная следующей:

util.js:38
      case '%s': return String(args[i++]);
                        ^
TypeError: Cannot convert object to primitive value
    at String (unknown source)
    at util.js:38:25
    at String.replace (native)
    at Object.<anonymous> (util.js:35:23)
    at Object.<anonymous> (console.js:25:36)
    at EventEmitter.<anonymous> (/project/src/routines/debug/boot.js:16:21)
    at EventEmitter.emit (/project/node_modules/eventemitter2/lib/eventemitter2.js:319:22)
    at /project/src/bootstrap.js:15:14
    at /project/src/util/routineloader.js:36:11
    at /project/src/util/routineloader.js:47:6

Что очень полезно. Когда я затем делаю где-нибудь следующее:

process.on('uncaughtException', function(err) {
        console.trace();
        throw err;
    });

я получаю только:

Trace: 
    at EventEmitter.<anonymous> (/project/src/routines/debug/exceptions.js:4:17)
    at EventEmitter.emit (events.js:88:20)

Что совсем не помогает.

Как заставить его возвращать всю трассировку стека, как исходную?

21
задан Tom 10 May 2012 в 17:23
поделиться