File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+ import ErrorButton from "./components/ErrorButton" ;
13import ToolCard from "./components/ToolCard" ;
24import Calculator from "./tools/Calculator" ;
35import PasswordGenerator from "./tools/PasswordGenerator" ;
@@ -19,4 +21,16 @@ export default function App() {
1921 ) ) }
2022 </ main >
2123 ) ;
24+ }
25+
26+ export default function ErrorButton ( ) {
27+ return (
28+ < button
29+ onClick = { ( ) => {
30+ throw new Error ( "This is your first error!" ) ;
31+ } }
32+ >
33+ Break the world
34+ </ button >
35+ ) ;
2236}
Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+
3+ export default function ErrorButton ( ) {
4+ return (
5+ < button
6+ onClick = { ( ) => {
7+ throw new Error ( "This is your first error!" ) ;
8+ } }
9+ >
10+ Break the world
11+ </ button >
12+ ) ;
13+ }
Original file line number Diff line number Diff line change 1- import "./sentry" ; // ⚠️ must be first
21import React from "react" ;
32import { createRoot } from "react-dom/client" ;
3+ import { ErrorBoundary } from "@sentry/react" ;
44import App from "./App" ;
5+ import "./sentry" ; // ⚠️ must be imported first
56
67const container = document . getElementById ( "app" ) ! ;
78const root = createRoot ( container ) ;
8- root . render ( < App /> ) ;
9+
10+ root . render (
11+ < ErrorBoundary fallback = { < h2 > Something went wrong.</ h2 > } >
12+ < App />
13+ </ ErrorBoundary >
14+ ) ;
You can’t perform that action at this time.
0 commit comments