Vue 3 Cheat Sheet



Global 2.2 2.2 Global Options Options Options 2.2 Options Options 2.2 Options 2.2 Methods Methods Methods Instance 2.2 2.1 html 2.1 Hooks html Built-In Modifiers Modifiers. Vue-Essentials-Cheat-Sheet.pdf Created Date: 3/14/2018 5:21:38 PM.

Vue 3 Cheat SheetVue

Details:

Called when an error from any descendent component is captured. The hook receives three arguments: the error, the component instance that triggered the error, and a string containing information on where the error was captured. The hook can return false to stop the error from propagating further.

TIP

Vue 3 Context

You can modify component state in this hook. However, it is important to have conditionals in your template or render function that short circuits other content when an error has been captured; otherwise the component will be thrown into an infinite render loop.

Vue 3 Cheat Sheet 2020

CheatVue 3 context

Error Propagation Rules

  • By default, all errors are still sent to the global config.errorHandler if it is defined, so that these errors can still be reported to an analytics service in a single place.

  • If multiple errorCaptured hooks exist on a component's inheritance chain or parent chain, all of them will be invoked on the same error.

  • If the errorCaptured hook itself throws an error, both this error and the original captured error are sent to the global config.errorHandler.

  • An errorCaptured hook can return false to prevent the error from propagating further. This is essentially saying 'this error has been handled and should be ignored.' It will prevent any additional errorCaptured hooks or the global config.errorHandler from being invoked for this error.