【发布时间】:2012-03-01 05:37:21
【问题描述】:
为了ease debugging 一些在 Internet Explorer 中行为异常的棘手异步 Javascript 代码,我想知道是否有可能在给定错误对象的情况下获取有关其原始位置的有用信息。
Firefox、Chrome、Opera 和我想所有其他不错的浏览器都让我这样做:
try{
throw Error('My custom error message');
}catch(e){
console.log(e.stack)
}
但我尝试的所有属性(error.stack 和error.lineNumber)都不能在 Internet Explorer 上运行。 有没有办法在 Internet Explorer 上仅使用 Javascript 获取此信息? 由于 IE REPL 将显示未处理异常的原始行号,即使它们被捕获并在不同的行中重新抛出,我假设我想要的信息存储在某处,但我不知道是否有公开的方式来获取它。
【问题讨论】:
标签: javascript debugging internet-explorer exception exception-handling