Skip to content

Commit 9433a18

Browse files
author
Luca Forstner
committed
error boundaries
1 parent 37e4052 commit 9433a18

File tree

1 file changed

+16
-2
lines changed
  • docs/platforms/javascript/guides/tanstackstart-react

1 file changed

+16
-2
lines changed

docs/platforms/javascript/guides/tanstackstart-react/index.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Make sure to keep your auth token secret and out of version control.
8181

8282
Add the following initialization code to your `app/client.tsx` file to initialize Sentry on the client:
8383

84-
```tsx {filename:app/client.tsx} {"onboardingOptions": {"performance": "13, 16-21", "session-replay": "14,22-27"}}
84+
```tsx {filename:app/client.tsx} {"onboardingOptions": {"performance": "12, 15-20", "session-replay": "13,21-26"}}
8585
import { hydrateRoot } from "react-dom/client";
8686
import { StartClient } from "@tanstack/react-start";
8787
import { createRouter } from "./router";
@@ -92,7 +92,6 @@ const router = createRouter();
9292

9393
Sentry.init({
9494
dsn: "___PUBLIC_DSN___",
95-
9695
integrations: [
9796
Sentry.tanstackRouterBrowserTracingIntegration(router),
9897
Sentry.replayIntegration(),
@@ -186,6 +185,21 @@ registerGlobalMiddleware({
186185

187186
The Sentry SDK cannot capture errors that you manually caught yourself with error boundaries.
188187

188+
If you have React error boundaries in your app and you want to report errors that these boundaries catch to Sentry, apply the [`withErrorBoundary` wrapper](/platforms/javascript/guides/react/features/error-boundary/) to your `ErrorBoundary`:
189+
190+
```tsx
191+
import React from "react";
192+
import * as Sentry from "@sentry/tanstackstart-react";
193+
194+
class MyErrorBoundary extends React.Component {
195+
// ...
196+
}
197+
198+
export const MySentryWrappedErrorBoundary = withErrorBoundary(MyErrorBoundary, {
199+
// ... sentry error wrapper options
200+
});
201+
```
202+
189203
If you defined `errorComponent`s in your Code-Based TanStack Router routes, capture the `error` argument with `captureException` inside a `useEffect` hook:
190204

191205
```tsx {2,6-8}

0 commit comments

Comments
 (0)