diff --git a/apps/app/package.json b/apps/app/package.json index df616446..b61853a9 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -20,7 +20,7 @@ "geist": "^1.3.1", "next": "14.2.7", "next-international": "^1.2.4", - "next-safe-action": "^7.8.1", + "next-safe-action": "^7.9.0", "next-themes": "^0.3.0", "nuqs": "^1.18.0", "react": "^18.3.1", diff --git a/apps/app/src/actions/safe-action.ts b/apps/app/src/actions/safe-action.ts index 3a32d4b0..7365baf8 100644 --- a/apps/app/src/actions/safe-action.ts +++ b/apps/app/src/actions/safe-action.ts @@ -11,24 +11,22 @@ import { import { headers } from "next/headers"; import { z } from "zod"; -export const actionClient = createSafeActionClient({ - handleReturnedServerError(e) { - if (e instanceof Error) { - return e.message; - } +const handleServerError = (e: Error) => { + console.error("Action error:", e.message); - return DEFAULT_SERVER_ERROR_MESSAGE; - }, + if (e instanceof Error) { + return e.message; + } + + return DEFAULT_SERVER_ERROR_MESSAGE; +}; + +export const actionClient = createSafeActionClient({ + handleServerError, }); export const actionClientWithMeta = createSafeActionClient({ - handleReturnedServerError(e) { - if (e instanceof Error) { - return e.message; - } - - return DEFAULT_SERVER_ERROR_MESSAGE; - }, + handleServerError, defineMetadataSchema() { return z.object({ name: z.string(), diff --git a/bun.lockb b/bun.lockb index e789afc2..de96de74 100755 Binary files a/bun.lockb and b/bun.lockb differ