NuxtErrorBoundary leaving a blank screen
I have this in my
layouts/dashboard.vue
file:
A page throws this error (see screenshot 1) so I was hoping the NuxtErrorBoundary
would catch that and stop it from bubbling up. But it doesn't, so nothing is rendered at all (see screenshot 2).
I did this to verify if NuxtErrorBoundary
was indeed "seeing" that there's an error in it's tree:
... and it does log the error. So, I'm confused.
Am I using NuxtErrorBoundary
wrong, or does it not support catching this kind of error?1 Reply
Obviously, I can fix the type error in the code by doing null checks, but this error made me think about using
NuxtErrorBoundary
to catch unexpected errors that I may not know about during development.
UPDATE: Found a workaround; not sure how much of a bad practise this is
1. I rewrote the error boundary code:
2. I created a error.vue
file beside app.vue
:
This gives me the behaviour I want.