Skip to content

Commit

Permalink
fix: throw errors on insight creation failure (#4145)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeucapua authored Sep 30, 2024
1 parent f54d043 commit e3f8db3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 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,6 +117,7 @@ export default function CreateContributorInsightPage({
if (error) {
toast({ description: "An error has occurred. Try again.", variant: "danger" });
setLoading(false);
captureException(new Error(`Error creating a contributor insight`, { cause: error }));
return;
}

Expand Down
2 changes: 2 additions & 0 deletions 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,6 +73,7 @@ const NewInsightPage = () => {
if (error) {
toast({ description: "An error has occurred. Try again.", variant: "danger" });
setLoading(false);
captureException(new Error(`Error creating a repository insight`, { cause: error }));
return;
}

Expand Down

0 comments on commit e3f8db3

Please sign in to comment.