Error Bubbling
π¨βπΌ To keep things consistent, Kellie (π§ββοΈ) has made a handy abstraction for error
boundaries. You can find it in .
Here's how you use it:
export function ErrorBoundary() {
return (
<GeneralErrorBoundary
statusHandlers={{
403: ({ params }) => (
<p>You're not authorized to look at {params.sandwichId}</p>
),
}}
/>
)
}
You can specify any status code you want, and the error boundary will render
whatever you return in your callback.
We'd like you to update the
ErrorBoundary
you've got already to use this,
and now we can add it to several of the /users/:userId/notes
routes as well.You'll notice that when a parent route has an error boundary, the child routes
errors will bubble up to the parent route unless they have one of their own. I
would love for you to play around with that idea a bit as well.