Skip to content

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

fix: change tRPC error code for ClickHouse errors (#9459)

Valery Meleshkin9842d842d82e
diff --git a/web/src/server/api/trpc.ts b/web/src/server/api/trpc.ts
index 30b82ecc64..14d7b08731 100644
--- a/web/src/server/api/trpc.ts
+++ b/web/src/server/api/trpc.ts
@@ -143,7 +143,7 @@ const withErrorHandling = t.middleware(async ({ ctx, next }) => {
// Surface ClickHouse errors using an advice message
// which is supposed to provide a bit of guidance to the user.
res.error = new TRPCError({
- code: "TIMEOUT",
+ code: "SERVICE_UNAVAILABLE",
message: ClickHouseResourceError.ERROR_ADVICE_MESSAGE,
});
} else {
diff --git a/web/src/utils/trpcErrorToast.tsx b/web/src/utils/trpcErrorToast.tsx
index 3144f7fc4f..3a2ceed34b 100644
--- a/web/src/utils/trpcErrorToast.tsx
+++ b/web/src/utils/trpcErrorToast.tsx
@@ -22,6 +22,7 @@ const errorTitleMap = {
TOO_MANY_REQUESTS: "Too Many Requests",
CLIENT_CLOSED_REQUEST: "Client Closed Request",
INTERNAL_SERVER_ERROR: "Internal Server Error",
+ SERVICE_UNAVAILABLE: "Backend Service Overloaded",
} as const;
const getErrorTitleAndHttpCode = (error: TRPCClientError<any>) => {