Implement event filtering and user feedback modal

This commit is contained in:
Enno Gelhaus 2025-09-19 17:36:51 +02:00 committed by GitHub
parent 6b4fa0763d
commit 015be12bca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 0 deletions

View File

@ -26,6 +26,26 @@ export const initializeSentryBasic = (environment: string, dsn: string, extensio
...extension,
debug: environment === 'development',
tracesSampleRate: environment === 'development' ? 1.0 : 0.3,
// Filtert Events und zeigt das User-Feedback-Modal an
beforeSend(event, hint) {
if (event.exception && event.exception.values) {
for (const exception of event.exception.values) {
// Filtert "Failed to fetch" Fehler heraus
if (exception.value && /Failed to fetch/.test(exception.value)) {
return null; // Verwirft den Event
}
}
}
// Wenn der Event eine Ausnahme ist und nicht gefiltert wurde,
// wird das User-Feedback-Modal angezeigt
if (event.exception && event.event_id) {
Sentry.showReportDialog({ eventId: event.event_id });
}
return event; // Sendet den Event an Sentry
},
});
} catch (err) {}
};