Skip to content

Commit 62bf803

Browse files
authored
fix(cloudflare): Improve SvelteKit framework guide code block (#11570)
1 parent 18361c6 commit 62bf803

File tree

1 file changed

+4
-2
lines changed
  • docs/platforms/javascript/guides/cloudflare/frameworks

1 file changed

+4
-2
lines changed

docs/platforms/javascript/guides/cloudflare/frameworks/sveltekit.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ compatibility_flags = ["nodejs_compat"]
2525
# compatibility_flags = ["nodejs_als"]
2626
```
2727

28-
To use this SDK, update your `src/hooks.server.ts` file to use the `Sentry.wrapRequestHandler` method from the Sentry Cloudflare SDK and remove the `Sentry.init` call from `@sentry/sveltekit`.
28+
To use this SDK, update your `src/hooks.server.(ts|js)` file to use the `Sentry.wrapRequestHandler` method from the Sentry Cloudflare SDK and remove the `Sentry.init` call from `@sentry/sveltekit`.
2929

30-
```diff
30+
```typescript diff {filename:hooks.server.(ts|js)}
3131
import { sequence } from "@sveltejs/kit/hooks";
3232
import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
3333
-import * as Sentry from '@sentry/sveltekit';
@@ -59,6 +59,8 @@ To use this SDK, update your `src/hooks.server.ts` file to use the `Sentry.wrapR
5959
-// If you have custom handlers, make sure to place them after `sentryHandle()` in the `sequence` function.
6060
-export const handle = sequence(sentryHandle());
6161
+export const handle = sequence(handleInitSentry, sentryHandle());
62+
63+
export const handleError = handleErrorWithSentry(myErrorHandler);
6264
```
6365

6466
If you need to use environmental variables, you can access them using `event.platform.env`.

0 commit comments

Comments
 (0)