Files
outline/app/utils/sentry.ts
Tom MoorandClaude Fable 5 a1d0520c9f Add missing JSDoc to exported members in app and server utils (#12940)
* Add missing JSDoc to exported members in app and server utils

Documents all exported functions, classes, enums, and constants in
app/utils and server/utils that were missing JSDoc, per the project
documentation guidelines.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AsEQYA8zN813thxu7GjjzU

* Use @returns tag to match codebase convention

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AsEQYA8zN813thxu7GjjzU

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-08 08:30:11 -04:00

60 lines
1.6 KiB
TypeScript

import * as Sentry from "@sentry/react";
import type { History } from "history";
import env from "~/env";
import {
AuthorizationError,
BadRequestError,
NetworkError,
NotFoundError,
OfflineError,
PaymentRequiredError,
RateLimitExceededError,
ServiceUnavailableError,
UpdateRequiredError,
} from "./errors";
/**
* Initializes the Sentry error tracking client for the browser.
*
* @param history the router history used for navigation instrumentation.
*/
export function initSentry(history: History) {
const ignoredErrorTypes = [
AuthorizationError,
BadRequestError,
NetworkError,
NotFoundError,
OfflineError,
PaymentRequiredError,
RateLimitExceededError,
ServiceUnavailableError,
UpdateRequiredError,
];
Sentry.init({
dsn: env.SENTRY_DSN,
environment: env.ENVIRONMENT,
release: env.VERSION,
tunnel: env.SENTRY_TUNNEL,
allowUrls: [env.URL, env.CDN_URL, env.COLLABORATION_URL],
integrations: [Sentry.reactRouterV5BrowserTracingIntegration({ history })],
tracesSampleRate: env.ENVIRONMENT === "production" ? 0.1 : 1,
ignoreErrors: [
"Failed to fetch dynamically imported module",
"Importing a module script failed",
"ResizeObserver loop completed with undelivered notifications",
"ResizeObserver loop limit exceeded",
"Object Not Found Matching Id",
"file://",
"chrome-extension://",
],
beforeSend(event, hint) {
const error = hint.originalException;
if (error && ignoredErrorTypes.some((type) => error instanceof type)) {
return null;
}
return event;
},
});
}