Skip to content

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

fix(sentry): don't throw trpcclienterror in sentry (#9534)

Nimar288b6d4ff29f
diff --git a/web/instrumentation-client.ts b/web/instrumentation-client.ts
index 3bc4ab9186..f18dd7ae3e 100644
--- a/web/instrumentation-client.ts
+++ b/web/instrumentation-client.ts
@@ -10,6 +10,23 @@ Sentry.init({
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,
release: process.env.NEXT_PUBLIC_BUILD_ID,
+ beforeSend(event, hint) {
+ const error = hint.originalException;
+
+ // Filter out TRPCClientErrors, we track them in DataDog.
+ // The users see those via toast notifications -> see handleTrpcError in web/src/utils/api.ts
+ if (
+ error &&
+ typeof error === "object" &&
+ "name" in error &&
+ error.name === "TRPCClientError"
+ ) {
+ return null;
+ }
+
+ return event;
+ },
+
// Replay may only be enabled for the client-side
integrations: [
Sentry.replayIntegration({