Having the k-error-boundary component listen for an event would allow developers to “throw” (actually
$emit) errors in, for example, field plugins where currently we can’t.
Currently we can
throw (really this time) errors in synchronous contexts, but not in asynchronous ones (for example in promise handlers).
Therefore, code like this is not caught by the error boundary, because for js it’s an “unhandled rejection”:
.catch((error) => throw 'could not load field');
Would be nice if we could “handle” rejections by explicitly emitting an “error” event to the error boundary:
.catch((error) => this.$emit('error', 'could not load field'));
More info on the forum: