| 1 | import * as Sentry from "@sentry/nextjs"; |
| 2 | |
| 3 | const Test5 = () => ( |
| 4 | <> |
| 5 | <h1>Client Test 5</h1> |
| 6 | <button |
| 7 | onClick={() => { |
| 8 | const transaction = Sentry.startTransaction({ |
| 9 | name: "Testing performance", |
| 10 | }); |
| 11 | Sentry.configureScope((scope) => { |
| 12 | scope.setSpan(transaction); |
| 13 | }); |
| 14 | |
| 15 | try { |
| 16 | // Some operation the button does, but fails |
| 17 | throw new Error("Client Test 5"); |
| 18 | } catch (error) { |
| 19 | Sentry.captureException(error); |
| 20 | } finally { |
| 21 | transaction.finish(); |
| 22 | } |
| 23 | }} |
| 24 | > |
| 25 | Click me to create a transaction and throw an Error |
| 26 | </button> |
| 27 | </> |
| 28 | ); |
| 29 | |
| 30 | export default Test5; |