gpt4 book ai didi

javascript - 如何在 Google Chrome Canary 中打开未捕获异常时暂停?

转载 作者:数据小太阳 更新时间:2023-10-29 05:29:39 26 4
gpt4 key购买 nike

在这篇文章中,它讨论了在未捕获的异常上打开暂停。 https://developer.chrome.com/devtools/docs/javascript-debugging

我只能在 Chrome 和 Canary 中看到捕获异常时暂停。我使用的是 Chrome Canary 版本 43.0.2344.2 canary(64 位)。

enter image description here

我收到一个 Uncaught SyntaxError: Unexpected token :, sourcing to a location (e.g. VM272) 并且如果没有调用堆栈的踪迹就很难追踪。

enter image description here

我搜索了一下,发现可以添加

> window.onerror = function() { debugger;}

在控制台中,但这并没有给我一个堆栈跟踪。 Scope 窗口确实提供了很多变量信息,但我还是有点不知所措。

enter image description here

最佳答案

文档有点过时了。

在新的 Chrome 版本中,“出现异常时暂停”按钮不再在 3 种状态(已禁用、“出现异常时暂停”、“”之间切换Pause on Uncaught Exceptions") 但仅在两种状态之间(disabled 和“Pause on Exception”)。

为了也能够中断捕获的异常,他们引入了这个复选框(如果您在 GWT 中有一个全局异常处理程序但仍然想中断,这很有用抛出异常时)。

因此,如果您没有捕捉到异常,那么您在屏幕截图中显示的设置应该有效。

关于javascript - 如何在 Google Chrome Canary 中打开未捕获异常时暂停?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29263440/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com