-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle backend errors in pool page (#1031)
* fix: pool page error when pool id is not found * fix: avoid alert var * fix: capture pool query backend errors in sentry * Update app/(app)/pools/[chain]/[variant]/[id]/layout.tsx Co-authored-by: Gareth Fuller <[email protected]> * Update app/(app)/pools/[chain]/[variant]/[id]/layout.tsx Co-authored-by: Gareth Fuller <[email protected]> * chore: Use error boundaries * chore: Minor updates * chore: Remove * chore: Handle errors better * chore: Update container height * fix: Await header --------- Co-authored-by: Gareth Fuller <[email protected]>
- Loading branch information
1 parent
128056b
commit deede8c
Showing
7 changed files
with
95 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { DefaultPageContainer } from '@/lib/shared/components/containers/DefaultPageContainer' | ||
import { Button, Heading, VStack, Text } from '@chakra-ui/react' | ||
import { headers } from 'next/headers' | ||
import Link from 'next/link' | ||
|
||
export default async function NotFound() { | ||
const headersList = headers() | ||
|
||
const referer = await headersList.get('referer') | ||
|
||
const poolIdSegment = 6 | ||
const maybePoolId = referer?.split('/')[poolIdSegment] | ||
const isPoolPageNotFound = maybePoolId?.startsWith('0x') | ||
|
||
const title = isPoolPageNotFound ? 'Pool Not Found' : 'Page Not Found' | ||
const description = isPoolPageNotFound | ||
? `The pool you are looking for does not exist: ${maybePoolId}` | ||
: 'The page you are looking for does not exist' | ||
|
||
const redirectUrl = isPoolPageNotFound ? `/pools` : '/' | ||
const redirectText = isPoolPageNotFound ? 'View All Pools' : 'Return Home' | ||
|
||
return ( | ||
<DefaultPageContainer minH="80vh"> | ||
<VStack align="start" spacing="md"> | ||
<Heading size="md">{title}</Heading> | ||
<VStack align="start" spacing="xs"> | ||
<Text>{description}</Text> | ||
</VStack> | ||
|
||
<Button as={Link} size="sm" href={redirectUrl}> | ||
{redirectText} | ||
</Button> | ||
</VStack> | ||
</DefaultPageContainer> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters