Is it possible to show <Errorboundary> as toast/pop up?
Or does it always need to show either the error component/view or the non error view?
6 Replies
The fallback prop can contain anything that is rendered on error - it can also be a toast. However, the default layout cannot be rendered, as it threw an error while doing so, so we do not get any output from it. If you want to show errors as toasts over the layout, you need to use catchError and resource.error to avoid errors being thrown at the boundary.
I will look into those
You can just have the error boundary inside your main layout, so main layout always renders.
I don't think I can get props.children of app.tsx to render simultaneously with that method.
Is there some example code with catcherror somewhere?
Well if you can just catch the error you can use it in any way you want.
ErrorBoundary is just for uncaught errors.
Eg.
… = createAsync(()=>getSomeData().catch(err => showToast(err))
Should work.That's not the whole story. Error boundaries are meant to encapsulate components that do not work. Imagine a video device selector when the error is "not permitted". At the app level, they work as a catch-all.