mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:11:48 +00:00
Svelte: add sentry (#63126)
This adds basic sentry support to the Sveltekit webapp.
This commit is contained in:
parent
a36b750842
commit
929258e8a0
@ -84,6 +84,7 @@ BUILD_DEPS = [
|
||||
":node_modules/@graphql-tools/utils",
|
||||
":node_modules/@iconify-json/lucide",
|
||||
":node_modules/@melt-ui/svelte",
|
||||
":node_modules/@sentry/sveltekit",
|
||||
":node_modules/@sourcegraph/branded",
|
||||
":node_modules/@sourcegraph/client-api",
|
||||
":node_modules/@sourcegraph/common",
|
||||
|
||||
@ -75,6 +75,7 @@
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.6.3",
|
||||
"@melt-ui/svelte": "^0.76.0",
|
||||
"@sentry/sveltekit": "^8.7.0",
|
||||
"@sourcegraph/branded": "workspace:*",
|
||||
"@sourcegraph/client-api": "workspace:*",
|
||||
"@sourcegraph/common": "workspace:*",
|
||||
|
||||
29
client/web-sveltekit/src/hooks.client.ts
Normal file
29
client/web-sveltekit/src/hooks.client.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { handleErrorWithSentry } from '@sentry/sveltekit'
|
||||
import * as Sentry from '@sentry/sveltekit'
|
||||
|
||||
Sentry.init({
|
||||
// Disabled if dsn is undefined
|
||||
dsn: window.context.sentryDSN ?? undefined,
|
||||
release: window.context.version,
|
||||
initialScope: {
|
||||
user: window.context.currentUser
|
||||
? {
|
||||
id: window.context.currentUser.databaseID,
|
||||
graphqlID: window.context.currentUser.id,
|
||||
username: window.context.currentUser.username,
|
||||
displayName: window.context.currentUser.displayName,
|
||||
email: window.context.currentUser.emails.find(email => email.isPrimary)?.email,
|
||||
}
|
||||
: undefined,
|
||||
tags: {
|
||||
app: 'sveltekit',
|
||||
siteID: window.context.siteID,
|
||||
externalURL: window.context.externalURL,
|
||||
},
|
||||
},
|
||||
|
||||
tracesSampleRate: 1.0,
|
||||
})
|
||||
|
||||
// If you have a custom error handler, pass it to `handleErrorWithSentry`
|
||||
export const handleError = handleErrorWithSentry()
|
||||
@ -36,6 +36,9 @@ export default defineConfig(({ mode }) => {
|
||||
graphqlCodegen(),
|
||||
inspect(),
|
||||
],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
},
|
||||
define:
|
||||
mode === 'test'
|
||||
? {}
|
||||
|
||||
847
pnpm-lock.yaml
847
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user