mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-30 11:26:24 +02:00
Guard trackEvent with try-catch
This commit is contained in:
parent
556646fe97
commit
0be3c79635
1 changed files with 14 additions and 10 deletions
|
|
@ -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> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue