vue-async-computed
vue-async-computed copied to clipboard
Call errorCaptured on Promise rejection
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')
}
}
}
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.)
Yes. Rejection error can escape the error boundary which catches error via errorCaptured
.