mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-11 10:32:54 +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 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 }) {
|
function myErrorHandler({ error, event }: { error: any; event: NavigationEvent }) {
|
||||||
console.error('An error occurred on the client side:', error, event);
|
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 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) {
|
export function setSentryUser(user: User) {
|
||||||
setUser({
|
setUser({
|
||||||
|
@ -6,6 +6,7 @@ import { UpdaterService } from '$lib/backend/updater';
|
|||||||
import { UserService } from '$lib/stores/user';
|
import { UserService } from '$lib/stores/user';
|
||||||
import { config } from 'rxjs';
|
import { config } from 'rxjs';
|
||||||
import { initPostHog } from '$lib/analytics/posthog';
|
import { initPostHog } from '$lib/analytics/posthog';
|
||||||
|
import { initSentry } from '$lib/analytics/sentry';
|
||||||
|
|
||||||
// call on startup so we don't accumulate old items
|
// call on startup so we don't accumulate old items
|
||||||
lscache.flushExpired();
|
lscache.flushExpired();
|
||||||
@ -20,6 +21,7 @@ export const csr = true;
|
|||||||
let homeDir: () => Promise<string>;
|
let homeDir: () => Promise<string>;
|
||||||
|
|
||||||
export const load: LayoutLoad = async ({ fetch: realFetch }: { fetch: typeof fetch }) => {
|
export const load: LayoutLoad = async ({ fetch: realFetch }: { fetch: typeof fetch }) => {
|
||||||
|
initSentry();
|
||||||
initPostHog();
|
initPostHog();
|
||||||
const userService = new UserService();
|
const userService = new UserService();
|
||||||
const updaterService = new UpdaterService();
|
const updaterService = new UpdaterService();
|
||||||
|
Loading…
Reference in New Issue
Block a user