Skip to content

Commit 81594af

Browse files
committed
Added button for testing
1 parent 7326d10 commit 81594af

3 files changed

Lines changed: 35 additions & 2 deletions

File tree

src/App.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from "react";
2+
import ErrorButton from "./components/ErrorButton";
13
import ToolCard from "./components/ToolCard";
24
import Calculator from "./tools/Calculator";
35
import 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
}

src/components/ErrorButton.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
}

src/main.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import "./sentry"; // ⚠️ must be first
21
import React from "react";
32
import { createRoot } from "react-dom/client";
3+
import { ErrorBoundary } from "@sentry/react";
44
import App from "./App";
5+
import "./sentry"; // ⚠️ must be imported first
56

67
const container = document.getElementById("app")!;
78
const root = createRoot(container);
8-
root.render(<App />);
9+
10+
root.render(
11+
<ErrorBoundary fallback={<h2>Something went wrong.</h2>}>
12+
<App />
13+
</ErrorBoundary>
14+
);

0 commit comments

Comments
 (0)