🤖 Capture errors in sentry

This commit is contained in:
Luke Vella 2023-11-06 19:10:52 +00:00
parent 88c86eae18
commit fcf05b3dae

View file

@ -1,5 +1,6 @@
import { createTRPCContext } from "@rallly/backend/trpc/context";
import { AppRouter, appRouter } from "@rallly/backend/trpc/routers";
import * as Sentry from "@sentry/nextjs";
import * as trpcNext from "@trpc/server/adapters/next";
import { absoluteUrl, shortUrl } from "@/utils/absolute-url";
@ -36,4 +37,9 @@ export default trpcNext.createNextApiHandler<AppRouter>({
shortUrl,
});
},
onError({ error }) {
if (error.code === "INTERNAL_SERVER_ERROR") {
Sentry.captureException(error);
}
},
});