{"id":18447781,"url":"https://github.com/stoplightio/react-error-boundary","last_synced_at":"2025-04-08T00:32:26.857Z","repository":{"id":35826305,"uuid":"210851753","full_name":"stoplightio/react-error-boundary","owner":"stoplightio","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-27T12:07:54.000Z","size":1574,"stargazers_count":1,"open_issues_count":5,"forks_count":1,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-05T22:43:22.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stoplightio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-25T13:26:14.000Z","updated_at":"2023-10-05T21:30:13.000Z","dependencies_parsed_at":"2024-06-18T22:39:41.348Z","dependency_job_id":"13b2f0d7-0b6b-45e3-87d3-07ac9532b4b5","html_url":"https://github.com/stoplightio/react-error-boundary","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"e63e98208ae45ee35744c1eed935d620a81001dd"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Freact-error-boundary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Freact-error-boundary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Freact-error-boundary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoplightio%2Freact-error-boundary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stoplightio","download_url":"https://codeload.github.com/stoplightio/react-error-boundary/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755460,"owners_count":20990618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:14:25.134Z","updated_at":"2025-04-08T00:32:21.848Z","avatar_url":"https://github.com/stoplightio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @stoplight/react-error-boundary\n\n\u003c!-- BADGES --\u003e\n\n\u003c!-- SUMMARY --\u003e\n\nThe React error boundary tailored to Stoplight needs, inspired by [react-error-boundary](https://github.com/bvaughn/react-error-boundary).\n\n- Explore the components: [Storybook](https://stoplightio.github.io/react-error-boundary)\n- View the changelog: [Releases](https://github.com/stoplightio/react-error-boundary/releases)\n\n### Features\n\n- all the great features provided by [react-error-boundary](https://github.com/bvaughn/react-error-boundary),\n- built-in error reporting powered by Sentry,\n- supports recovering,\n- fallback component can try to recover error boundary.\n\n### Installation\n\nSupported in modern browsers and node.\n\n```bash\n# latest stable\nyarn add @stoplight/react-error-boundary\n```\n\n### Usage\n\nYou can either make use of:\n\n- withErrorBoundary HOC\n\n```tsx\nimport { withErrorBoundary } from '@stoplight/react-error-boundary';\n\nconst SchemaViewer: React.FunctionComponent\u003c{ schema: unknown }\u003e = ({ schema }) =\u003e {\n  if (typeof schema !== 'object' || schema === null) {\n    throw new Error('Schema must be an object');\n  }\n\n  if (Object.keys(schema).length === 0) {\n    throw new Error('Schema cannot be empty');\n  }\n\n  return \u003cspan\u003eThis is fine.\u003c/span\u003e;\n};\n\nconst MyWrappedComponent = withErrorBoundary(SchemaViewer, {\n  recoverableProps: ['schema'],\n});\n\nconst Page = () =\u003e (\n  \u003cdiv\u003e\n    \u003ch1\u003eSchema Viewer\u003c/h1\u003e\n    \u003cMyWrappedComponent schema={{}} /\u003e\n  \u003c/div\u003e\n);\n```\n\n- ErrorBoundary component\n\n```tsx\nimport { ErrorBoundary } from '@stoplight/react-error-boundary';\n\nconst SchemaViewer: React.FunctionComponent\u003c{ schema: unknown }\u003e = ({ schema }) =\u003e {\n  if (typeof schema !== 'object' || schema === null) {\n    throw new Error('Schema must be an object');\n  }\n\n  if (Object.keys(schema).length === 0) {\n    throw new Error('Schema cannot be empty');\n  }\n\n  return \u003cspan\u003eThis is fine.\u003c/span\u003e;\n};\n\nconst Page = () =\u003e (\n  \u003cdiv\u003e\n    \u003ch1\u003eSchema Viewer\u003c/h1\u003e\n    \u003cErrorBoundary\u003e\n      \u003cSchemaViewer schema={{}} /\u003e\n    \u003c/ErrorBoundary\u003e\n  \u003c/div\u003e\n);\n```\n\n### Contributing\n\n1. Clone repo.\n2. Create / checkout `feature/{name}`, `chore/{name}`, or `fix/{name}` branch.\n3. Install deps: `yarn`.\n4. Make your changes.\n5. Run tests: `yarn test.prod`.\n6. Stage relevant files to git.\n7. Commit: `yarn commit`. _NOTE: Commits that don't follow the [conventional](https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional) format will be rejected. `yarn commit` creates this format for you, or you can put it together manually and then do a regular `git commit`._\n8. Push: `git push`.\n9. Open PR targeting the `master` branch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoplightio%2Freact-error-boundary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoplightio%2Freact-error-boundary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoplightio%2Freact-error-boundary/lists"}