Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

add error logging on server only

Amruth Pillai0a609306a6a2
diff --git a/src/integrations/orpc/client.ts b/src/integrations/orpc/client.ts
index 871146c9e..26f9c7ded 100644
--- a/src/integrations/orpc/client.ts
+++ b/src/integrations/orpc/client.ts
@@ -11,11 +11,6 @@ import { getLocale } from "@/utils/locale";
export const getORPCClient = createIsomorphicFn()
.server((): RouterClient<typeof router> => {
return createRouterClient(router, {
- // interceptors: [
- // onError((error) => {
- // console.error(error);
- // }),
- // ],
context: async () => {
const locale = await getLocale();
const reqHeaders = getRequestHeaders();
@@ -30,16 +25,10 @@ export const getORPCClient = createIsomorphicFn()
.client((): RouterClient<typeof router> => {
const link = new RPCLink({
url: `${window.location.origin}/api/rpc`,
+ plugins: [new BatchLinkPlugin({ groups: [{ condition: () => true, context: {} }] })],
fetch: (request, init) => {
return fetch(request, { ...init, credentials: "include" });
},
- // interceptors: [
- // onError((error) => {
- // if (error instanceof DOMException) return;
- // console.error(error);
- // }),
- // ],
- plugins: [new BatchLinkPlugin({ groups: [{ condition: () => true, context: {} }] })],
});
return createORPCClient(link);
diff --git a/src/routes/api/openapi.$.ts b/src/routes/api/openapi.$.ts
index 0e7cfa34a..d28833a24 100644
--- a/src/routes/api/openapi.$.ts
+++ b/src/routes/api/openapi.$.ts
@@ -1,6 +1,7 @@
import { SmartCoercionPlugin } from "@orpc/json-schema";
import { OpenAPIGenerator } from "@orpc/openapi";
import { OpenAPIHandler } from "@orpc/openapi/fetch";
+import { onError } from "@orpc/server";
import { RequestHeadersPlugin } from "@orpc/server/plugins";
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
import { createFileRoute } from "@tanstack/react-router";
@@ -9,11 +10,11 @@ import { env } from "@/utils/env";
import { getLocale } from "@/utils/locale";
const openAPIHandler = new OpenAPIHandler(router, {
- // interceptors: [
- // onError((error) => {
- // console.error(error);
- // }),
- // ],
+ interceptors: [
+ onError((error) => {
+ console.error(`ERROR [OpenAPI]: ${error}`);
+ }),
+ ],
plugins: [
new RequestHeadersPlugin(),
new SmartCoercionPlugin({
diff --git a/src/routes/api/rpc.$.ts b/src/routes/api/rpc.$.ts
index f0cf563ba..5e22af1d4 100644
--- a/src/routes/api/rpc.$.ts
+++ b/src/routes/api/rpc.$.ts
@@ -1,3 +1,4 @@
+import { onError } from "@orpc/server";
import { RPCHandler } from "@orpc/server/fetch";
import { BatchHandlerPlugin, RequestHeadersPlugin } from "@orpc/server/plugins";
import { createFileRoute } from "@tanstack/react-router";
@@ -5,11 +6,11 @@ import router from "@/integrations/orpc/router";
import { getLocale } from "@/utils/locale";
const rpcHandler = new RPCHandler(router, {
- // interceptors: [
- // onError((error) => {
- // console.error(error);
- // }),
- // ],
+ interceptors: [
+ onError((error) => {
+ console.error(`ERROR [oRPC]: ${error}`);
+ }),
+ ],
plugins: [new BatchHandlerPlugin(), new RequestHeadersPlugin()],
});