Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(sentry): only report server side errors (5xx) to sentry; skip reporting client side errors (#7682)

marliessophie3965a5174fe6
diff --git a/web/src/utils/api.ts b/web/src/utils/api.ts
index a23289e69a..fbe1d78adb 100644
--- a/web/src/utils/api.ts
+++ b/web/src/utils/api.ts
@@ -57,7 +57,6 @@ let buildId: string | null = null;
const CLIENT_STALE_CACHE_CODES = [404, 400];
const handleTrpcError = (error: unknown) => {
- captureException(error);
if (error instanceof TRPCClientError) {
const httpStatus: number =
typeof error.data?.httpStatus === "number" ? error.data.httpStatus : 500;
@@ -72,6 +71,13 @@ const handleTrpcError = (error: unknown) => {
return;
}
}
+ // Only send server errors (5xx) to Sentry, not client errors (4xx)
+ if (httpStatus >= 500 && httpStatus < 600) {
+ captureException(error);
+ }
+ } else {
+ // For non-TRPC errors, still send to Sentry
+ captureException(error);
}
trpcErrorToast(error);