All checks were successful
Frontend CI / build (push) Successful in 1m16s
- Added Sentry initialization in both client and server hooks. - Configured Sentry with environment variables for DSN and sampling rates. - Implemented error handling with Sentry in server hooks. - Updated environment configuration to include SENTRY_DSN. - Configured Vite to upload source maps to Sentry.
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { sequence } from '@sveltejs/kit/hooks';
|
|
import * as Sentry from '@sentry/sveltekit';
|
|
import { PostRepositoryImpl } from '$lib/post/adapter/gateway/postRepositoryImpl';
|
|
import { PostBloc } from '$lib/post/adapter/presenter/postBloc';
|
|
import { PostListBloc } from '$lib/post/adapter/presenter/postListBloc';
|
|
import { GetAllPostsUseCase } from '$lib/post/application/useCase/getAllPostsUseCase';
|
|
import { GetPostUseCase } from '$lib/post/application/useCase/getPostUseCase';
|
|
import { PostApiServiceImpl } from '$lib/post/framework/api/postApiServiceImpl';
|
|
import type { Handle } from '@sveltejs/kit';
|
|
import { Environment } from '$lib/environment';
|
|
|
|
Sentry.init({
|
|
dsn: Environment.SENTRY_DSN,
|
|
tracesSampleRate: 1,
|
|
enableLogs: true
|
|
});
|
|
|
|
export const handle: Handle = sequence(Sentry.sentryHandle(), ({ event, resolve }) => {
|
|
const postApiService = new PostApiServiceImpl(event.fetch);
|
|
const postRepository = new PostRepositoryImpl(postApiService);
|
|
const getAllPostsUseCase = new GetAllPostsUseCase(postRepository);
|
|
const getPostUseCase = new GetPostUseCase(postRepository);
|
|
|
|
event.locals.postListBloc = new PostListBloc(getAllPostsUseCase);
|
|
event.locals.postBloc = new PostBloc(getPostUseCase);
|
|
|
|
return resolve(event);
|
|
});
|
|
|
|
export const handleError = Sentry.handleErrorWithSentry();
|