sentry beforeSend ignore 403 404

This commit is contained in:
pa
2025-10-19 20:46:59 +09:00
committed by Natsumi
parent 8c1b6d3e51
commit f016ab9e0c
+10 -6
View File
@@ -41,14 +41,18 @@ export async function initSentry(app) {
replaysSessionSampleRate: 0, replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: 1.0, replaysOnErrorSampleRate: 1.0,
tracesSampleRate: 0.05, tracesSampleRate: 0.05,
beforeSend(event) { beforeSend(event, hint) {
if ( const error = hint.originalException;
event.request?.status !== 404 && if (error && typeof error.message === 'string') {
event.request?.status !== 403 && if (
event.request?.status !== -1 error.message.includes('403') ||
) { error.message.includes('404')
) {
return null;
}
return event; return event;
} }
return event;
}, },
integrations: [ integrations: [
Sentry.replayIntegration({ Sentry.replayIntegration({