Files
Folo/apps/desktop/layer/renderer/src/initialize/sentry.ts
T
Innei 861442edc5 chore(sentry): enhance Sentry configuration for improved error tracking
- Updated Sentry configuration to include new integrations such as eventFilters, moduleMetadata, httpClient, and reactRouterV6BrowserTracing.
- Expanded the list of ignored error patterns to cover more specific cases, improving error handling.
- Removed redundant error handling logic from the Sentry initialization process, streamlining the setup.

These changes aim to enhance error tracking capabilities and improve overall application stability.

Signed-off-by: Innei <tukon479@gmail.com>
2025-08-29 16:26:03 +08:00

33 lines
918 B
TypeScript

import { ELECTRON_BUILD } from "@follow/shared/constants"
import { whoami } from "@follow/store/user/getters"
import { appSessionTraceId } from "@follow/utils/environment"
import { version } from "@pkg"
import { nanoid } from "nanoid"
import { SentryConfig } from "./sentry.config"
Object.defineProperty(window.Error.prototype, "traceId", {
get() {
if (!this._traceId) {
this._traceId = nanoid()
}
return this._traceId
},
})
export const initSentry = async () => {
if (!window.SENTRY_RELEASE) return
if (import.meta.env.DEV) return
const Sentry = await import("@sentry/react")
Sentry.init(SentryConfig)
const user = whoami()
if (user) {
Sentry.setTag("user_id", user.id)
Sentry.setTag("user_name", user.name)
}
Sentry.setTag("session_trace_id", appSessionTraceId)
Sentry.setTag("app_version", version)
Sentry.setTag("build", ELECTRON_BUILD ? "electron" : "web")
}