You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/javascript/guides/cloudflare/frameworks/hydrogen-react-router.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,12 +115,14 @@ startTransition(() => {
115
115
hydrateRoot(
116
116
document,
117
117
<StrictMode>
118
-
<HydratedRouter />
118
+
<HydratedRouteronError={Sentry.sentryOnError}/>
119
119
</StrictMode>
120
120
);
121
121
});
122
122
```
123
123
124
+
The `sentryOnError` handler integrates with React Router's [`onError` hook](https://reactrouter.com/how-to/error-reporting) to automatically capture and report client-side errors to Sentry.
125
+
124
126
### Configure Server-side Sentry
125
127
126
128
First, create an `instrument.server.mjs` file to initialize Sentry on the server:
// you only want to capture non 404-errors that reach the boundary
180
-
+Sentry.captureException(error);
181
-
if (import.meta.env.DEV) {
182
-
details=error.message;
183
-
stack=error.stack;
184
-
}
185
-
}
186
-
187
-
return (
188
-
<main>
189
-
<h1>{message}</h1>
190
-
<p>{details}</p>
191
-
{stack&& (
192
-
<pre>
193
-
<code>{stack}</code>
194
-
</pre>
195
-
)}
196
-
</main>
197
-
);
198
-
}
199
-
// ...
200
-
```
160
+
The `sentryOnError` handler integrates with React Router's [`onError` hook](https://reactrouter.com/how-to/error-reporting) to automatically capture and report client-side errors to Sentry.
0 commit comments