Open
Description
This issue was discussed in #3627, but it's been marked and stale as locked so I'm opening another issue.
As discussed in #3627, create-react-app will always display an error overlay for errors in development mode, even when the error is caught via an error boundary. This confused me at first, and it's also confusing users of the routing library I maintain. This library throws a NotFoundError
when it can't match a URL segment, and uses a <NotFoundBoundary>
component to allow the user to render a 404 page.
<div className='App'>
<Sidebar />
<main>
<NotFoundBoundary render={() => <NotFoundPage />}>
{/**
<View /> throws a NotFoundError if they can't find a route any content for
the part of the URL they correspond to. They can be nested, so even if
this view doesn't throw, a child view might -- thus boundaries are 👌
**/}
<View />
</NotFoundBoundary>
</main>
</div>
I feel like the best approach would be to not show error overlays for caught errors (Dan mentioned it's on his todos). But just making it clearer that the error was caught would be a big improvement.