Currently there is only one boundary - NotFoundBoundary which catches only NotFoundError errors. In my app I also need to prevent access to specific pages and for that I would like to create a custom error - e.g.AccessDeniedError and corresponding boundary as well. But I'm not sure how to do it. The original NotFoundBoundary uses NaviContext which is not exported.
import { NaviContext } from './NaviContext'
export const NotFoundBoundary: React.SFC<NotFoundBoundaryProps> = function ErrorBoundary(props: NotFoundBoundaryProps) {
return (
<NaviContext.Consumer>
{context => <InnerNotFoundBoundary context={context} {...props} />}
</NaviContext.Consumer>
)
}
So how can one add new error types and effectively catch them?