The error view package is a React Error Boundary. From the React documentation itself:
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed. Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.
This package provides an ErrorView
wrapper component that takes a render prop
as a direct child of the component. This function returns three possible values
which can be used to handle the enclosed child components:
-
error
- the error that was returned -
hasError
- boolean, did the component error -
onError
- a function that handles errors and triggers the error view components error handling
Please read CONTRIBUTING.md before contributing to this package
Please see our main README.md to get the project running locally
The code can be formatted and linted in accordance with the agreed standards.
yarn fmt
yarn lint
This package uses yarn (latest) to run unit tests on each platform with jest.
yarn test:web
Visit the official storybook to see our available error view templates.