diff --git a/src/app/(dashboard)/[guildUrlName]/[pageUrlName]/page.tsx b/src/app/(dashboard)/[guildUrlName]/[pageUrlName]/page.tsx
index f35cb1fba4..9b6a1aa843 100644
--- a/src/app/(dashboard)/[guildUrlName]/[pageUrlName]/page.tsx
+++ b/src/app/(dashboard)/[guildUrlName]/[pageUrlName]/page.tsx
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/Button";
import { Card } from "@/components/ui/Card";
import { ScrollArea } from "@/components/ui/ScrollArea";
import { Skeleton } from "@/components/ui/Skeleton";
-import { CustomError } from "@/lib/error";
+import { CustomError, FetchError } from "@/lib/error";
import { rewardBatchOptions, roleBatchOptions } from "@/lib/options";
import type { Schemas } from "@guildxyz/types";
import { Lock } from "@phosphor-icons/react/dist/ssr";
@@ -14,7 +14,6 @@ import { useSuspenseQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
import { Suspense } from "react";
import { ErrorBoundary } from "react-error-boundary";
-import { ZodError } from "zod";
const GuildPage = () => {
const { pageUrlName, guildUrlName } = useParams<{
@@ -48,12 +47,11 @@ const GuildPage = () => {
const RoleCard = ({ role }: { role: Schemas["Role"] }) => {
const blacklistedRoleName = "Member";
if (role.name === blacklistedRoleName) {
- throw new ZodError([]);
- //throw new FetchError({
- // recoverable: true,
- // message: `Failed to show ${role.name} role`,
- // cause: FetchError.expected`${{ roleName: role.name }} to not match ${{ blacklistedRoleName }}`,
- //});
+ throw new FetchError({
+ recoverable: true,
+ message: `Failed to show ${role.name} role`,
+ cause: FetchError.expected`${{ roleName: role.name }} to not match ${{ blacklistedRoleName }}`,
+ });
}
const { data: rewards } = useSuspenseQuery(
rewardBatchOptions({ roleId: role.id }),
diff --git a/src/app/(dashboard)/[guildUrlName]/layout.tsx b/src/app/(dashboard)/[guildUrlName]/layout.tsx
index a02183106e..b01405616a 100644
--- a/src/app/(dashboard)/[guildUrlName]/layout.tsx
+++ b/src/app/(dashboard)/[guildUrlName]/layout.tsx
@@ -9,7 +9,9 @@ import {
userOptions,
} from "@/lib/options";
import type { DynamicRoute } from "@/lib/types";
+import { Status } from "@reflet/http";
import { HydrationBoundary, dehydrate } from "@tanstack/react-query";
+import { notFound } from "next/navigation";
import { type PropsWithChildren, Suspense } from "react";
import { GuildTabs, GuildTabsSkeleton } from "./components/GuildTabs";
import { JoinButton } from "./components/JoinButton";
@@ -65,8 +67,11 @@ const GuildLayout = async ({
}).queryKey,
);
- if (guild?.error || !guild?.data) {
- throw new Error(`Failed to fetch guild ${guild?.error?.status || ""}`);
+ if (guild?.error?.partialResponse.status === Status.NotFound) {
+ notFound();
+ }
+ if (!guild?.data) {
+ throw new Error("Failed to fetch guild");
}
return (
diff --git a/src/app/(dashboard)/explorer/components/InfiniteScrollGuilds.tsx b/src/app/(dashboard)/explorer/components/InfiniteScrollGuilds.tsx
index 4078a7b89d..f64d1e7844 100644
--- a/src/app/(dashboard)/explorer/components/InfiniteScrollGuilds.tsx
+++ b/src/app/(dashboard)/explorer/components/InfiniteScrollGuilds.tsx
@@ -51,7 +51,7 @@ export const InfiniteScrollGuilds = () => {
? // biome-ignore lint: it's safe to use index as key in this case
[...Array(PAGE_SIZE)].map((_, i) =>