Vue: errorCaptured and errorHandler should capture errors in v-on handlers

Created on 29 Oct 2017  ·  4Comments  ·  Source: vuejs/vue

Version

2.5.2

Reproduction link

https://codesandbox.io/s/k9rlpoojpr

Steps to reproduce

Click on throw error button in reproduction link

What is expected?

This should display an alert with error object, handled by errorCaptured hook defined in App.vue component.

What is actually happening?

The errorCaptured hook is not invoked


It seems that typings in options.d.ts is not the same as specified in the docs too.

https://github.com/vuejs/vue/blob/96472be6f62a98d3b5d6b784fe341a71ba3a68eb/types/options.d.ts#L83
https://vuejs.org/v2/api/#errorCaptured

improvement intend to implement

Most helpful comment

We currently only capture errors in the following:

  • render functions
  • watcher callbacks
  • lifecycle hooks
  • component event handlers

DOM event handlers are currently not included and probably should.

All 4 comments

We currently only capture errors in the following:

  • render functions
  • watcher callbacks
  • lifecycle hooks
  • component event handlers

DOM event handlers are currently not included and probably should.

What’s the status?

Are there any plans to fix this?

Closed via #8395 (will be out 2.6)

Was this page helpful?
0 / 5 - 0 ratings