Panel JS / Vue: does anyone know how I can throw an error from inside a promise, inside of a field plugin, so that the message is caught by the errorboundary that kirby wraps around my field?
let me explain… This works:
created() {
throw 'This is an error';
}
This doesn’t:
methods: {
fails() {
return new Promise((resolve, reject) => reject('this is an error'))
}
},
created() {
this.fails().catch(error => throw error)
}
it doesn’t work because it’s “Uncaught (in promise)” - I’ve tried manually notifying the errorboundary with something like this.fails().catch(error => this.$emit('error', error))
. But it doesn’t seem like the kirby error boundary has that function.
Related: Show error/info message when panel plugin has missing options