Skip to content

Commit

Permalink
fix thread not found state
Browse files Browse the repository at this point in the history
  • Loading branch information
Southclaws committed Oct 6, 2024
1 parent 622f7bd commit 9bde2b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion app/services/thread_mark/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/Southclaws/fault"
"github.com/Southclaws/fault/ftag"
"github.com/dboslee/lru"
"github.com/rs/xid"
"go.uber.org/fx"
Expand All @@ -12,7 +13,7 @@ import (
"github.com/Southclaws/storyden/app/resources/post/thread"
)

var ErrInvalidThreadMark = fault.New("invalid thread mark: thread mark did not point to a valid thread ID")
var ErrInvalidThreadMark = fault.New("invalid thread mark: thread mark did not point to a valid thread ID", ftag.With(ftag.NotFound))

// from xid
const xidEncodedLength = 20
Expand Down
19 changes: 13 additions & 6 deletions web/src/app/(dashboard)/t/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ export default async function Page(props: Props) {
}

export async function generateMetadata({ params }: Props) {
const info = await getInfo();
const { data } = await threadGet(params.slug);
try {
const info = await getInfo();
const { data } = await threadGet(params.slug);

return {
title: `${data.title} | ${info.title}`,
description: data.description,
};
return {
title: `${data.title} | ${info.title}`,
description: data.description,
};
} catch (e) {
return {
title: "Thread Not Found",
description: "The thread you are looking for does not exist.",
};
}
}
2 changes: 0 additions & 2 deletions web/src/components/site/Unready.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import { ExclamationTriangleIcon } from "@heroicons/react/24/solid";

import { Box, CardBox, Center, HStack, styled } from "@/styled-system/jsx";
Expand Down

0 comments on commit 9bde2b2

Please sign in to comment.