在Chrome中,当发生Javascript错误时,您可以选择断点错误并查看源中错误的确切位置。然后,您可以点击左下角的{}按钮展开源代码,如果它被缩小到一行。
现在,每当遇到错误时,我都会从实际生产用户那里获得堆栈跟踪转储。它们看起来像这样:
错误:[$ rootScope:inprog] http://errors.angularjs.org/1.2.10/ $ rootScope / inprog?P0 =%24digest
Ç@ http://www.example.com/js/application.731658e4b865.js:12:89879 $适用@ http://www.example.com/js/application.731658e4b865.js:13:698 http://www.example.com/js/application.731658e4b865.js:14:6848 调度@ http://www.example.com/js/application.731658e4b865.js:2:27867 手柄@ http://www.example.com/js/application.731658e4b865.js:2:24604 的setAttribute @ ATTR @ http://www.example.com/js/application.731658e4b865.js:2:21147 访问@ http://www.example.com/js/application.731658e4b865.js:1:28433 ATTR @ http://www.example.com/js/application.731658e4b865.js:2:17793 $ @集http://www.example.com/js/application.731658e4b865.js:12:15493 http://www.example.com/js/application.731658e4b865.js:14:682 http://www.example.com/js/application.731658e4b865.js:12:15546 forEach @ [本机代码] 小号@ http://www.example.com/js/application.731658e4b865.js:11:35483 $ @集http://www.example.com/js/application.731658e4b865.js:12:15523 http://www.example.com/js/application.731658e4b865.js:12:14390 $消化@ http://www.example.com/js/application.731658e4b865.js:12:91816 $适用@ http://www.example.com/js/application.731658e4b865.js:13:773 http://www.example.com/js/application.731658e4b865.js:13:5948 ø@ http://www.example.com/js/application.731658e4b865.js:11:48586 http://www.example.com/js/application.731658e4b865.js:12:176
我的问题是:如何从此堆栈跟踪转储中获取相同的功能并在源代码中查看它?我知道你可以按CMD + O并打开文件到特定的行/列号,但这可以通过编程方式完成吗?