Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🔊 Capture exceptions from safe action in sentry (#1854)

Luke Vella71f706d56493
diff --git a/apps/web/src/lib/safe-action/server.ts b/apps/web/src/lib/safe-action/server.ts
index 39277a1ff..50630c481 100644
--- a/apps/web/src/lib/safe-action/server.ts
+++ b/apps/web/src/lib/safe-action/server.ts
@@ -1,6 +1,7 @@
import "server-only";
import { posthog } from "@rallly/posthog/server";
+import * as Sentry from "@sentry/nextjs";
import { waitUntil } from "@vercel/functions";
import { createMiddleware, createSafeActionClient } from "next-safe-action";
import z from "zod";
@@ -66,7 +67,16 @@ export const actionClient = createSafeActionClient({
z.object({
actionName: z.string(),
}),
- handleServerError: async (error) => {
+ handleServerError: async (error, { metadata }) => {
+ Sentry.captureException(error, {
+ tags: {
+ errorHandler: "safe-action",
+ },
+ extra: {
+ actionName: metadata.actionName,
+ },
+ });
+
if (error instanceof AppError) {
return error.code;
}