[Vuejs]-Handling error on a vue component render function

0👍

You can wrap your render function under a try / catch block to handle the exception. But you’ll need to decide what to render in this case.

return () => {
  try {
    return h('Component', {
      modelValue: resolveModel(), <-- How to handle exception thrown here?
    })
  } catch (renderError) {
    // Handle the exception, but it has to return something to render
    return h()
  }
}

Leave a comment