📌  相关文章
📜  js 在侦听器上捕获错误 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:48.852000             🧑  作者: Mango

代码示例1
// If you would like to access errors thrown from event handlers, 
// you may listen to the error event on window.
// It will be emitted for all uncaught errors in the current JavaScript VM:
window.addEventListener('error', function(event) {
  console.log("Got an uncaught error: ", event.error)
})