Skip to content

Commit

Permalink
use sentry captureException
Browse files Browse the repository at this point in the history
  • Loading branch information
zeucapua committed Sep 27, 2024
1 parent 47da0b0 commit d500c4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pages/workspaces/[workspaceId]/contributor-insights/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useRouter } from "next/router";
import { GetServerSidePropsContext } from "next";
import { ComponentProps, useEffect, useState } from "react";
import { createPagesServerClient } from "@supabase/auth-helpers-nextjs";
import { captureException } from "@sentry/nextjs";
import { fetchApiData } from "helpers/fetchApiData";
import { deleteCookie, setCookie } from "lib/utils/server/cookies";
import { WORKSPACE_ID_COOKIE_NAME } from "lib/utils/caching";
Expand Down Expand Up @@ -116,7 +117,8 @@ export default function CreateContributorInsightPage({
if (error) {
toast({ description: "An error has occurred. Try again.", variant: "danger" });
setLoading(false);
throw new Error(`Error creating a contributor insight`, { cause: error });
captureException(new Error(`Error creating a contributor insight`, { cause: error }));
return;
}

toast({ description: "Insight created! Redirecting...", variant: "success" });
Expand Down
4 changes: 3 additions & 1 deletion pages/workspaces/[workspaceId]/repository-insights/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useRouter } from "next/router";
import { ComponentProps, useEffect, useState } from "react";
import { GetServerSidePropsContext } from "next";
import { createPagesServerClient } from "@supabase/auth-helpers-nextjs";
import { captureException } from "@sentry/nextjs";
import useSupabaseAuth from "lib/hooks/useSupabaseAuth";
import { createRepositoryInsight } from "lib/utils/workspace-utils";

Expand Down Expand Up @@ -72,7 +73,8 @@ const NewInsightPage = () => {
if (error) {
toast({ description: "An error has occurred. Try again.", variant: "danger" });
setLoading(false);
throw new Error(`Error creating a repository insight`, { cause: error });
captureException(new Error(`Error creating a repository insight`, { cause: error }));
return;
}

toast({ description: "Insight created! Redirecting...", variant: "success" });
Expand Down

0 comments on commit d500c4c

Please sign in to comment.