最近 Google Chrome 访问错误对象 (43.0.2357.65 m)

Accessing error object in recent Google Chrome (43.0.2357.65 m)

我刚刚更新到 Google Chrome 43.0.2357.65 并且正在编写 Javascript 代码来将错误记录到控制台;类似于:

try { ...} // raise some error
catch(e) {console.log(e); ...}

我过去曾用它来记录错误 object 并检查其属性。现在,我所看到的只是一个无法访问 Error 对象本身的堆栈跟踪。这是预期的行为吗?有什么方法可以检查控制台中的错误对象吗?

我不知道这是否是预期的行为,但我已经能够重现差异并且快速修复是使用 console.dir 函数。 console.dir 是一个很好的功能,总是 作为一个对象出现在控制台上,即使你做了类似 console.dir("a string").

的事情

Displays an interactive list of the properties of the specified JavaScript object. The output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.

来源:https://developer.mozilla.org/en-US/docs/Web/API/Console/dir