mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-12 22:14:54 +10:00
add error logging on server only
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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()],
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user