What is the Handled filter in Chrome DevTools used for?

时间:2015-10-30 22:04:25

标签: javascript console filtering google-chrome-devtools

Chrome DevTools has several useful filters to limit the logging: Errors, Warnings, Info etc.

The last filter is called Handled, and I have yet to find out what that is used for. The is no console.handle() or similar. Googling hasn't provided an answer.

For what and how do I use the Handled filter?

1 个答案:

答案 0 :(得分:26)

此过滤器用于承诺内部处理的异常。已使用this patch将过滤器添加到用户界面。包含test和关联ticket会显示此功能的全部内容。

如果我们创建一个承诺并拒绝它:

var p = new Promise((resolve, reject) => reject('ooops'))

错误信息将立即打印到控制台:

uncaught error in promise

但是,拒绝可以在以后处理:

p.catch(e => {})

导致上一条错误消息改变状态:

handled error

Uncaught(in promise)ooops ”成为“处理的承诺拒绝”。由于它不再被视为错误,因此当“错误”过滤器处于活动状态时,它不会显示。但是,当新的“ Handled ”过滤器处于活动状态时,它会显示出来。

revoked error not visible when "errors" filter is active

revoked error visible when "Handled" filter is active

相关问题