Javascript 异常堆栈跟踪 [英] Javascript exception stack trace
本文介绍了Javascript 异常堆栈跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Firefox 中,我可以使用 exception.stack
获取异常的堆栈跟踪.
In Firefox I can get the stack trace of an exception by using exception.stack
.
有没有办法在其他浏览器中也能做到这一点?
Is there a way to get that in other browsers, too?
我实际上想自动保存堆栈跟踪(如果可能的话)而不是当时调试它(即我知道如何在调试器中获取堆栈跟踪).
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
也许值得看看这个工具.
这篇关于Javascript 异常堆栈跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文