Skip to content

Commit

Permalink
Prevent error tracking spam
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphiiko committed Oct 30, 2024
1 parent d4d0345 commit 125f258
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src-ui/app/services/telemetry.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export class TelemetryService {
);
public settings: Observable<TelemetrySettings> = this._settings.asObservable();

private trackedJSErrors: string[] = [];

constructor() {}

async init() {
Expand All @@ -48,6 +50,14 @@ export class TelemetryService {
});

window.addEventListener('error', (e) => {
const errorData = JSON.stringify({
filename: e.filename,
lineno: e.lineno,
colno: e.colno,
message: e.message,
});
if (this.trackedJSErrors.includes(errorData)) return;
this.trackedJSErrors.push(errorData);
this.trackEvent('ui_js_error', {
message: e.message,
});
Expand Down

0 comments on commit 125f258

Please sign in to comment.