Filter errors that get sent to Sentry (#5247)

This commit is contained in:
Hailey
2024-09-25 15:05:33 -07:00
committed by GitHub
parent b1ca2503de
commit 58036ffb52
4 changed files with 30 additions and 15 deletions
+8 -2
View File
@@ -1,10 +1,11 @@
import format from 'date-fns/format'
import {nanoid} from 'nanoid/non-secure'
import {Sentry} from '#/logger/sentry'
import * as env from '#/env'
import {DebugContext} from '#/logger/debugContext'
import {add} from '#/logger/logDump'
import {Sentry} from '#/logger/sentry'
import {isNetworkError} from 'lib/strings/errors'
import * as env from '#/env'
export enum LogLevel {
Debug = 'debug',
@@ -160,6 +161,11 @@ export const sentryTransport: Transport = (
timestamp: timestamp / 1000, // Sentry expects seconds
})
// We don't want to send any network errors to sentry
if (isNetworkError(message)) {
return
}
/**
* Send all higher levels with `captureMessage`, with appropriate severity
* level