Skip to content

Commit d3c7939

Browse files
authored
fix(remix): Code example for handleError (#10597)
* fix(remix): Code example for `handleError` * add function params
1 parent d6c7735 commit d3c7939

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/platforms/javascript/guides/remix/manual-setup.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,17 @@ Sentry's Remix SDK will automatically record your [`action`](https://remix.run/d
189189

190190
To capture server-side errors automatically, instrument the [`handleError`](https://remix.run/docs/en/main/file-conventions/entry.server#handleerror) function in your server entry point.
191191

192-
If you're using Sentry Remix SDK version `7.87.0` or higher, you can use `wrapHandleErrorWithSentry` to export as your `handleError` function.
192+
If you're using Sentry Remix SDK version `7.87.0` or higher, you can wrap your error handler with `wrapHandleErrorWithSentry` or use `sentryHandleError` to export as your `handleError` function.
193193

194194
```typescript {filename: entry.server.tsx (@sentry/remix >= 7.87.0)}
195-
import { wrapHandleErrorWithSentry } from "@sentry/remix";
195+
import * as Sentry from "@sentry/remix";
196+
197+
export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {
198+
// Custom handleError implementation
199+
});
196200

197-
export const handleError = wrapHandleErrorWithSentry;
201+
// Alternative: Use the Sentry utility function if you don't need to wrap a custom function
202+
export const handleError = Sentry.sentryHandleError;
198203
```
199204

200205
For SDK versions older than `7.87.0`, you can use `Sentry.captureRemixServerException` to capture errors inside `handleError`.

0 commit comments

Comments
 (0)