Subscribe on changes!

The error thrown in async effect is not passed to the app.config.errorHandler

avatar
Jan 30th 2021

Version

3.0.5

Reproduction link

https://codepen.io/foyzhao/pen/OJbJYWV

Steps to reproduce

import { createApp, ref, watch, watchEffect } from 'vue'

const app = createApp({
  setup() {
    const count = ref(1)

    watch(count, () => {
      throw new Error('error1')
    }, { immediate: true })

    watch(count, async () => {
      throw new Error('error2')
    }, { immediate: true })

    watchEffect(() => {
      throw new Error('error3')
    })

    watchEffect(async () => {
      throw new Error('error4')
    })
  }
})

app.config.errorHandler = (err) => {
  console.log(err)
}

app.mount('#app')

What is expected?

Error 1~4 should all be passed to app.config.errorHandler

What is actually happening?

Error 4 was not passed to app.config.errorHandler

avatar
Jan 30th 2021