Javascript异常堆栈跟踪

问题描述:

在Firefox中,我可以使用 exception.stack 获取异常的堆栈跟踪。

In Firefox I can get the stack trace of an exception by using exception.stack.

是否

编辑:我实际上希望自动保存堆栈跟踪(如果可能),而不是调试它(即我知道如何在调试器中获取堆栈跟踪)。

I actually want to save the stack trace automatically (if possible) and not debug it at the time (i.e. I know how to get the stack trace in a debugger).

将此行放在哪里要打印堆栈跟踪:

Place this line where you want to print the stack trace:

console.log(new Error().stack);

注意:由我在 Chrome 24 Firefox 18

可能值得一看此工具