vue-async-computed icon indicating copy to clipboard operation
vue-async-computed copied to clipboard

Call errorCaptured on Promise rejection

Open johannes-z opened this issue 5 years ago • 2 comments

When throwing an Error inside the get () method of the asyncComputed, the component's registered errorCaptured handler is not being called. Can/Should this be added?

  errorCaptured: (err, vm, info) => {
    console.log(arguments)
  },
  asyncComputed: {
    posts: {
      lazy: true,
      default: () => [],
      async get () {
        throw new Error('error')
      }
    }
  }

johannes-z avatar Mar 05 '19 09:03 johannes-z

Yes, I see. vue-async-computed predates the errorCaptured error handling mechanism in Vue, so that's why it has it's own different error handling. But now that Vue has this robust error handling mechanism, it makes sense to use it, at least as a fallback after vue-async-computed's error handling. (And then in the next major version of vue-async-computed, I suppose I'd remove vue-async-computed's own custom error handling completely.)

foxbenjaminfox avatar Mar 19 '19 19:03 foxbenjaminfox

Yes. Rejection error can escape the error boundary which catches error via errorCaptured.

ladjzero avatar Feb 09 '21 03:02 ladjzero