Files
llink/js/desktop/src/lib/sentry.ts
T
Arjun PatelandGitHub a8a0b7db1b infra: add linting and formatting for js projects (#230)
* wip

* wip

* wip

* format

* wip(mobile): lint and format

* cleanup

* nits

* nits

* idiomatic react

* nit

* format all root files
2026-06-02 07:44:24 -07:00

29 lines
801 B
TypeScript

import * as Sentry from '@sentry/electron/renderer';
import { appConfig, appEnv } from '@/config/env';
import { installErrorSinks } from '@/lib/errors';
/**
* Initialise Sentry for a renderer process. No-ops when `sentryDsn` is empty
* so dev builds and unconfigured envs stay quiet.
*/
export function initSentryRenderer(): void {
if (!appConfig.sentryDsn) return;
Sentry.init({
dsn: appConfig.sentryDsn,
environment: appEnv,
tracesSampleRate: 0,
});
installErrorSinks({
capture: (err, context) => Sentry.captureException(err, { extra: context }),
breadcrumb: (err, context) =>
Sentry.addBreadcrumb({
category: 'error',
level: 'error',
message: err instanceof Error ? err.message : String(err),
data: context,
}),
});
}