Sorry, we don't support your browser.  Install a modern browser

Panel Vue: Error Boundary listens to "error" events#157

TL;DR
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.

Longer version
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”:

fetch('does-not-exist')
  .then(handle)
  .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:

fetch('does-not-exist')
  .then(handle)
  .catch((error) => this.$emit('error', 'could not load field'));

More info on the forum:
https://forum.getkirby.com/t/how-to-throw-async-errors-in-field-plugins-so-that-the-kirby-error-boundary-catches-them/19779

a month ago