aboutsummaryrefslogtreecommitdiff
path: root/src/lib/common/Sentry.ts
blob: 27922031720c176d0754e2f8a19004ab98227d2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { RewriteFrames } from '@sentry/integrations';
import * as SentryNode from '@sentry/node';
import { Integrations } from '@sentry/node';
import type { Config } from '../../../config/Config.js';

export class Sentry {
	public constructor(rootdir: string, config: Config) {
		if (config.credentials.sentryDsn === null) throw TypeError('sentryDsn cannot be null');

		SentryNode.init({
			dsn: config.credentials.sentryDsn,
			environment: config.environment,
			tracesSampleRate: 1.0,
			integrations: [
				new RewriteFrames({
					root: rootdir
				}),
				new Integrations.OnUnhandledRejection({
					mode: 'none'
				})
			]
		});
	}
}