Guard trackEvent with try-catch

This commit is contained in:
CREDO23 2026-04-07 20:22:00 +02:00
parent 556646fe97
commit 0be3c79635

View file

@ -25,16 +25,20 @@ export function initAnalytics(): void {
export function trackEvent(event: string, properties?: Record<string, unknown>): void {
if (!client) return;
client.capture({
distinctId,
event,
properties: {
platform: 'desktop',
app_version: app.getVersion(),
os: process.platform,
...properties,
},
});
try {
client.capture({
distinctId,
event,
properties: {
platform: 'desktop',
app_version: app.getVersion(),
os: process.platform,
...properties,
},
});
} catch {
// Analytics should never break the app
}
}
export async function shutdownAnalytics(): Promise<void> {