Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Added error ignoring for Sentry (#174)

Yevhenii Kulisidi9d83f765f092
diff --git a/apps/production/src/common/constants.ts b/apps/production/src/common/constants.ts
index 81708410d..a93e54a1c 100644
--- a/apps/production/src/common/constants.ts
+++ b/apps/production/src/common/constants.ts
@@ -120,6 +120,39 @@ const TRAFFIC_COLUMNS = [
const CAPTCHA_COLUMNS = ['cc', 'br', 'os', 'dv']
const PERFORMANCE_COLUMNS = ['cc', 'rg', 'ct', 'pg', 'dv', 'br']
+const sentryIgnoreErrors: (string | RegExp)[] = [
+ 'BadRequestException',
+ 'UnauthorizedException',
+ 'PaymentRequiredException',
+ 'ForbiddenException',
+ 'NotFoundException',
+ 'MethodNotAllowedException',
+ 'NotAcceptableException',
+ 'ProxyAuthenticationRequiredException',
+ 'RequestTimeoutException',
+ 'ConflictException',
+ 'GoneException',
+ 'LengthRequiredException',
+ 'PreconditionFailedException',
+ 'PayloadTooLargeException',
+ 'URITooLongException',
+ 'UnsupportedMediaTypeException',
+ 'RangeNotSatisfiableException',
+ 'ExpectationFailedException',
+ 'ImATeapotException',
+ 'MisdirectedRequestException',
+ 'UnprocessableEntityException',
+ 'LockedException',
+ 'FailedDependencyException',
+ 'TooEarlyException',
+ 'UpgradeRequiredException',
+ 'PreconditionRequiredException',
+ 'TooManyRequestsException',
+ 'RequestHeaderFieldsTooLargeException',
+ 'UnavailableForLegalReasonsException',
+ 'ClientClosedRequestException',
+]
+
export {
clickhouse,
redis,
@@ -159,4 +192,5 @@ export {
TRAFFIC_COLUMNS,
CAPTCHA_COLUMNS,
PERFORMANCE_COLUMNS,
+ sentryIgnoreErrors,
}
diff --git a/apps/production/src/main.ts b/apps/production/src/main.ts
index d97e5fcc1..99588f89c 100644
--- a/apps/production/src/main.ts
+++ b/apps/production/src/main.ts
@@ -7,7 +7,7 @@ import { getBotToken } from 'nestjs-telegraf'
import { ConfigService } from '@nestjs/config'
import * as Sentry from '@sentry/node'
-import { isDevelopment } from './common/constants'
+import { isDevelopment, sentryIgnoreErrors } from './common/constants'
import { AppModule } from './app.module'
import { SentryInterceptor } from './common/interceptors/sentry.interceptor'
@@ -24,6 +24,7 @@ async function bootstrap() {
Sentry.init({
dsn: configService.get<string>('SENTRY_DSN'),
tracesSampleRate: isProduction ? 0.1 : 1.0,
+ ignoreErrors: sentryIgnoreErrors,
})
app.useGlobalInterceptors(new SentryInterceptor())