From 9c2d8df9d0a0788303f356c5e665bc3da729530c Mon Sep 17 00:00:00 2001 From: Kazuma Oe Date: Thu, 5 Jan 2023 08:53:49 +0000 Subject: [PATCH 1/7] [docs] add `@sentry/svelte` import for clarity --- documentation/docs/30-advanced/20-hooks.md | 3 +++ documentation/docs/30-advanced/25-errors.md | 2 ++ 2 files changed, 5 insertions(+) diff --git a/documentation/docs/30-advanced/20-hooks.md b/documentation/docs/30-advanced/20-hooks.md index 39eb6710f59f..540e0f1ecab5 100644 --- a/documentation/docs/30-advanced/20-hooks.md +++ b/documentation/docs/30-advanced/20-hooks.md @@ -164,6 +164,7 @@ const Sentry: any; // @filename: index.js // ---cut--- +import * as Sentry from '@sentry/svelte'; import crypto from 'crypto'; /** @type {import('@sveltejs/kit').HandleServerError} */ @@ -187,6 +188,8 @@ const Sentry: any; // @filename: index.js // ---cut--- +import * as Sentry from '@sentry/svelte'; + /** @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..a578ad4f4e01 100644 --- a/documentation/docs/30-advanced/25-errors.md +++ b/documentation/docs/30-advanced/25-errors.md @@ -87,6 +87,8 @@ const Sentry: any; // @filename: index.js // ---cut--- +import * as Sentry from '@sentry/svelte'; + /** @type {import('@sveltejs/kit').HandleServerError} */ export function handleError({ error, event }) { // example integration with https://sentry.io/ From 666d31dc24d93b217269b37f57828fb544d9242a Mon Sep 17 00:00:00 2001 From: Kazuma Oe Date: Thu, 5 Jan 2023 23:38:13 +0900 Subject: [PATCH 2/7] Update documentation/docs/30-advanced/20-hooks.md Co-authored-by: Lukas Stracke --- documentation/docs/30-advanced/20-hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/30-advanced/20-hooks.md b/documentation/docs/30-advanced/20-hooks.md index 540e0f1ecab5..92732190a588 100644 --- a/documentation/docs/30-advanced/20-hooks.md +++ b/documentation/docs/30-advanced/20-hooks.md @@ -164,7 +164,7 @@ const Sentry: any; // @filename: index.js // ---cut--- -import * as Sentry from '@sentry/svelte'; +import * as Sentry from '@sentry/node'; import crypto from 'crypto'; /** @type {import('@sveltejs/kit').HandleServerError} */ From 2f603cf1276e59a8683d80690a58c8e38dc2cac0 Mon Sep 17 00:00:00 2001 From: Kazuma Oe Date: Thu, 5 Jan 2023 23:38:25 +0900 Subject: [PATCH 3/7] Update documentation/docs/30-advanced/20-hooks.md Co-authored-by: Lukas Stracke --- documentation/docs/30-advanced/20-hooks.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/docs/30-advanced/20-hooks.md b/documentation/docs/30-advanced/20-hooks.md index 92732190a588..b35354d59715 100644 --- a/documentation/docs/30-advanced/20-hooks.md +++ b/documentation/docs/30-advanced/20-hooks.md @@ -190,6 +190,8 @@ const Sentry: any; // ---cut--- import * as Sentry from '@sentry/svelte'; +Sentry.init({...}) + /** @type {import('@sveltejs/kit').HandleClientError} */ export function handleError({ error, event }) { const errorId = crypto.randomUUID(); From 2d492f1847561f507f907a0b7fbe95852f8f8549 Mon Sep 17 00:00:00 2001 From: Kazuma Oe Date: Thu, 5 Jan 2023 23:38:31 +0900 Subject: [PATCH 4/7] Update documentation/docs/30-advanced/25-errors.md Co-authored-by: Lukas Stracke --- documentation/docs/30-advanced/25-errors.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documentation/docs/30-advanced/25-errors.md b/documentation/docs/30-advanced/25-errors.md index a578ad4f4e01..b88ea2631637 100644 --- a/documentation/docs/30-advanced/25-errors.md +++ b/documentation/docs/30-advanced/25-errors.md @@ -87,7 +87,9 @@ const Sentry: any; // @filename: index.js // ---cut--- -import * as Sentry from '@sentry/svelte'; +import * as Sentry from '@sentry/node'; + +Sentry.init({...}) /** @type {import('@sveltejs/kit').HandleServerError} */ export function handleError({ error, event }) { From 5ddb7315e588846a7533871fc34da85044217b8c Mon Sep 17 00:00:00 2001 From: Kazuma Oe Date: Thu, 5 Jan 2023 23:41:35 +0900 Subject: [PATCH 5/7] Update documentation/docs/30-advanced/20-hooks.md Co-authored-by: Lukas Stracke --- documentation/docs/30-advanced/20-hooks.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/docs/30-advanced/20-hooks.md b/documentation/docs/30-advanced/20-hooks.md index b35354d59715..4555f84bd09a 100644 --- a/documentation/docs/30-advanced/20-hooks.md +++ b/documentation/docs/30-advanced/20-hooks.md @@ -165,6 +165,8 @@ const Sentry: any; // @filename: index.js // ---cut--- import * as Sentry from '@sentry/node'; + +Sentry.init({...}) import crypto from 'crypto'; /** @type {import('@sveltejs/kit').HandleServerError} */ From cd11cdaa721aa7063dd4bc8618e26147ccf33152 Mon Sep 17 00:00:00 2001 From: Kazuma Oe Date: Thu, 5 Jan 2023 14:46:32 +0000 Subject: [PATCH 6/7] Update documentation/docs/30-advanced/20-hooks.md --- documentation/docs/30-advanced/20-hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/30-advanced/20-hooks.md b/documentation/docs/30-advanced/20-hooks.md index 4555f84bd09a..423a88f1bfc3 100644 --- a/documentation/docs/30-advanced/20-hooks.md +++ b/documentation/docs/30-advanced/20-hooks.md @@ -165,9 +165,9 @@ const Sentry: any; // @filename: index.js // ---cut--- import * as Sentry from '@sentry/node'; +import crypto from 'crypto'; Sentry.init({...}) -import crypto from 'crypto'; /** @type {import('@sveltejs/kit').HandleServerError} */ export function handleError({ error, event }) { From 5c5938723cb44eafe86ea3adc47663071ce2fd0d Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 5 Jan 2023 10:10:28 -0500 Subject: [PATCH 7/7] fix --- documentation/docs/30-advanced/20-hooks.md | 14 ++++++++++---- documentation/docs/30-advanced/25-errors.md | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/documentation/docs/30-advanced/20-hooks.md b/documentation/docs/30-advanced/20-hooks.md index 423a88f1bfc3..5b43aeb94b53 100644 --- a/documentation/docs/30-advanced/20-hooks.md +++ b/documentation/docs/30-advanced/20-hooks.md @@ -160,14 +160,17 @@ 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({...}) +Sentry.init({/*...*/}) /** @type {import('@sveltejs/kit').HandleServerError} */ export function handleError({ error, event }) { @@ -186,13 +189,16 @@ 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({...}) +Sentry.init({/*...*/}) /** @type {import('@sveltejs/kit').HandleClientError} */ export function handleError({ error, event }) { diff --git a/documentation/docs/30-advanced/25-errors.md b/documentation/docs/30-advanced/25-errors.md index b88ea2631637..697bbfd5f248 100644 --- a/documentation/docs/30-advanced/25-errors.md +++ b/documentation/docs/30-advanced/25-errors.md @@ -83,13 +83,16 @@ 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({...}) +Sentry.init({/*...*/}) /** @type {import('@sveltejs/kit').HandleServerError} */ export function handleError({ error, event }) {