{"id":24874652,"url":"https://github.com/dirheimerb/react-reerror","last_synced_at":"2025-03-27T02:15:46.385Z","repository":{"id":241586076,"uuid":"807121672","full_name":"dirheimerb/react-reerror","owner":"dirheimerb","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-28T18:22:57.000Z","size":7898,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T07:28:56.808Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dirheimerb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-28T14:20:00.000Z","updated_at":"2024-05-28T18:23:00.000Z","dependencies_parsed_at":"2024-05-29T06:39:42.981Z","dependency_job_id":null,"html_url":"https://github.com/dirheimerb/react-reerror","commit_stats":null,"previous_names":["dirheimerb/react-reerror"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Freact-reerror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Freact-reerror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Freact-reerror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Freact-reerror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dirheimerb","download_url":"https://codeload.github.com/dirheimerb/react-reerror/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245767360,"owners_count":20668826,"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":"2025-02-01T07:28:05.825Z","updated_at":"2025-03-27T02:15:46.366Z","avatar_url":"https://github.com/dirheimerb.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Error Boundary with Custom Logger\n\nThis project is a React application with an integrated error boundary that logs errors to the console and posts them to Jsonbin.io for further analysis.\n\n## Features\n\n- Error Boundary to catch JavaScript errors anywhere in the component tree.\n- Custom logger to log errors to the console and send them to Jsonbin.io.\n- Custom error handling for both caught and uncaught errors in React 19.\n\n## Installation\n\n1. Clone the repository:\n\n   ```sh\n   git clone https://github.com/yourusername/react-error-boundary-logger.git\n   cd react-error-boundary-logger\n   ```\n\n2. Install the dependencies:\n\n   ```sh\n   npm install\n   ```\n\n## Configuration\n\n1. Open `src/logger.ts` and replace `YOUR_JSONBIN_MASTER_KEY` with your actual Jsonbin.io master key.\n\n   ```env\n    REACT_APP_API_ENDPOINT=https://api.jsonbin.io/v3/b\n    REACT_APP_API_KEY= # Add Valid Key, Required\n    REACT_APP_ADMIN_KEY=# Add Valid Key, Required\n    REACT_APP_BIN_NAME=# Add Valid Bin Name, Not Required\n    REACT_APP_BIN_PRIVATE=# Add true or false, Not Required\n    REACT_APP_COLLECTION_ID=# Add Valid Collection ID, Not Required\n   ```\n\n## Usage\n\n1. Start the development server:\n\n   ```sh\n   npm start\n   ```\n\n2. The application will be available at `http://localhost:3000`.\n\n## Project Structure\n\n- `src/`: Contains the source code of the React application.\n  - `App.tsx`: The main application component.\n  - `ErrorBoundary.tsx`: The Error Boundary component to catch and log errors.\n  - `logger.ts`: The custom logger utility to log errors to the console and send them to Jsonbin.io.\n  - `index.tsx`: The entry point of the React application.\n\n## Error Logging\n\nThe custom logger logs errors in the following format:\n\n```json\n{\n  \"error\": {\n    \"errorInfo\": \"\",\n    \"errorMessage\": \"\",\n    \"timestamp\": \"\"\n  },\n  \"metadata\": {\n    \"created\": \"\",\n    \"component\": null\n  }\n}\n```\n\n### Example\n\nTo see the error logging in action, introduce an error in any component, for example, in `App.tsx`:\n\n```tsx\nfunction App() {\n  // This will throw an error\n  throw new Error('Test error');\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003ch1\u003eWelcome to the App\u003c/h1\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\nThis will trigger the error boundary and log the error to the console as well as send it to Jsonbin.io.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirheimerb%2Freact-reerror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdirheimerb%2Freact-reerror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirheimerb%2Freact-reerror/lists"}