web: make most client/network errors ignored by sentry

This commit is contained in:
Jens Langhammer
2020-12-12 23:32:55 +01:00
parent d2862ddc93
commit 434922f702
6 changed files with 31 additions and 5 deletions

View File

@ -2,6 +2,7 @@ import { DefaultClient } from "./client";
import * as Sentry from "@sentry/browser";
import { Integrations } from "@sentry/tracing";
import { VERSION } from "../constants";
import { SentryIgnoredError } from "../common/errors";
export class Config {
branding_logo: string;
@ -24,6 +25,12 @@ export class Config {
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 1.0,
environment: config.error_reporting_environment,
beforeSend(event: Sentry.Event, hint: Sentry.EventHint) {
if (hint.originalException instanceof SentryIgnoredError) {
return null;
}
return event;
},
});
console.debug("authentik/config: Sentry enabled.");
}