diff --git a/documentation/docs/30-advanced/20-hooks.md b/documentation/docs/30-advanced/20-hooks.md index 39eb6710f59f..5b43aeb94b53 100644 --- a/documentation/docs/30-advanced/20-hooks.md +++ b/documentation/docs/30-advanced/20-hooks.md @@ -160,12 +160,18 @@ declare namespace App { /// file: src/hooks.server.js // @errors: 2322 // @filename: ambient.d.ts -const Sentry: any; +declare module '@sentry/node' { + export const init: (opts: any) => void; + export const captureException: (error: any, opts: any) => void; +} // @filename: index.js // ---cut--- +import * as Sentry from '@sentry/node'; import crypto from 'crypto'; +Sentry.init({/*...*/}) + /** @type {import('@sveltejs/kit').HandleServerError} */ export function handleError({ error, event }) { const errorId = crypto.randomUUID(); @@ -183,10 +189,17 @@ export function handleError({ error, event }) { /// file: src/hooks.client.js // @errors: 2322 // @filename: ambient.d.ts -const Sentry: any; +declare module '@sentry/svelte' { + export const init: (opts: any) => void; + export const captureException: (error: any, opts: any) => void; +} // @filename: index.js // ---cut--- +import * as Sentry from '@sentry/svelte'; + +Sentry.init({/*...*/}) + /** @type {import('@sveltejs/kit').HandleClientError} */ export function handleError({ error, event }) { const errorId = crypto.randomUUID(); diff --git a/documentation/docs/30-advanced/25-errors.md b/documentation/docs/30-advanced/25-errors.md index 331a992d3466..697bbfd5f248 100644 --- a/documentation/docs/30-advanced/25-errors.md +++ b/documentation/docs/30-advanced/25-errors.md @@ -83,10 +83,17 @@ Unexpected errors will go through the [`handleError`](/docs/hooks#shared-hooks-h /// file: src/hooks.server.js // @errors: 2322 1360 2571 2339 // @filename: ambient.d.ts -const Sentry: any; +declare module '@sentry/node' { + export const init: (opts: any) => void; + export const captureException: (error: any, opts: any) => void; +} // @filename: index.js // ---cut--- +import * as Sentry from '@sentry/node'; + +Sentry.init({/*...*/}) + /** @type {import('@sveltejs/kit').HandleServerError} */ export function handleError({ error, event }) { // example integration with https://sentry.io/