mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-30 20:09:50 +03:00
Move Sentry initialization
- makes sense to have it in sentry.ts and called from root layout.ts
This commit is contained in:
parent
3915ff2530
commit
14cafcdc1e
@ -1,14 +1,5 @@
|
||||
import { handleErrorWithSentry, init } from '@sentry/sveltekit';
|
||||
import { handleErrorWithSentry } from '@sentry/sveltekit';
|
||||
import type { NavigationEvent } from '@sveltejs/kit';
|
||||
import { dev } from '$app/environment';
|
||||
import { PUBLIC_SENTRY_ENVIRONMENT } from '$env/static/public';
|
||||
|
||||
init({
|
||||
enabled: !dev,
|
||||
dsn: 'https://a35bbd6688a3a8f76e4956c6871f414a@o4504644069687296.ingest.sentry.io/4505976067129344',
|
||||
environment: PUBLIC_SENTRY_ENVIRONMENT,
|
||||
tracesSampleRate: 1.0
|
||||
});
|
||||
|
||||
function myErrorHandler({ error, event }: { error: any; event: NavigationEvent }) {
|
||||
console.error('An error occurred on the client side:', error, event);
|
||||
|
@ -1,5 +1,17 @@
|
||||
import { startSpan, setUser, type Span } from '@sentry/sveltekit';
|
||||
import { startSpan, setUser, type Span, init } from '@sentry/sveltekit';
|
||||
|
||||
import type { User } from '../backend/cloud';
|
||||
import { dev } from '$app/environment';
|
||||
import { PUBLIC_SENTRY_ENVIRONMENT } from '$env/static/public';
|
||||
|
||||
export function initSentry() {
|
||||
init({
|
||||
enabled: !dev,
|
||||
dsn: 'https://a35bbd6688a3a8f76e4956c6871f414a@o4504644069687296.ingest.sentry.io/4505976067129344',
|
||||
environment: PUBLIC_SENTRY_ENVIRONMENT,
|
||||
tracesSampleRate: 1.0
|
||||
});
|
||||
}
|
||||
|
||||
export function setSentryUser(user: User) {
|
||||
setUser({
|
||||
|
@ -6,6 +6,7 @@ import { UpdaterService } from '$lib/backend/updater';
|
||||
import { UserService } from '$lib/stores/user';
|
||||
import { config } from 'rxjs';
|
||||
import { initPostHog } from '$lib/analytics/posthog';
|
||||
import { initSentry } from '$lib/analytics/sentry';
|
||||
|
||||
// call on startup so we don't accumulate old items
|
||||
lscache.flushExpired();
|
||||
@ -20,6 +21,7 @@ export const csr = true;
|
||||
let homeDir: () => Promise<string>;
|
||||
|
||||
export const load: LayoutLoad = async ({ fetch: realFetch }: { fetch: typeof fetch }) => {
|
||||
initSentry();
|
||||
initPostHog();
|
||||
const userService = new UserService();
|
||||
const updaterService = new UpdaterService();
|
||||
|
Loading…
Reference in New Issue
Block a user