Skip to content

Commit

Permalink
fix(remix): Code example for handleError (#10597)
Browse files Browse the repository at this point in the history
* fix(remix): Code example for `handleError`

* add function params
  • Loading branch information
s1gr1d authored and sentrivana committed Jul 16, 2024
1 parent 3df94f4 commit 6421267
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docs/platforms/javascript/guides/remix/manual-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,17 @@ Sentry's Remix SDK will automatically record your [`action`](https://remix.run/d

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.

If you're using Sentry Remix SDK version `7.87.0` or higher, you can use `wrapHandleErrorWithSentry` to export as your `handleError` function.
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.

```typescript {filename: entry.server.tsx (@sentry/remix >= 7.87.0)}
import { wrapHandleErrorWithSentry } from "@sentry/remix";
import * as Sentry from "@sentry/remix";

export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {
// Custom handleError implementation
});

export const handleError = wrapHandleErrorWithSentry;
// Alternative: Use the Sentry utility function if you don't need to wrap a custom function
export const handleError = Sentry.sentryHandleError;
```

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

0 comments on commit 6421267

Please sign in to comment.