Skip to content

Commit dee4739

Browse files
rohan-chaturvediteyim
authored andcommitted
feat: improve error page (phasehq#595)
1 parent 813752e commit dee4739

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

frontend/app/error.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
'use client' // Error components must be Client components
1+
'use client'
22

33
import { Button } from '@/components/common/Button'
44
import { HeroPattern } from '@/components/common/HeroPattern'
55
import { useEffect } from 'react'
6+
import OnboardingNavbar from '@/components/layout/OnboardingNavbar'
67

78
export default function Error({ error, reset }: { error: Error; reset: () => void }) {
89
useEffect(() => {
9-
// Log the error to an error reporting service
1010
console.error(error)
1111
}, [error])
1212

1313
return (
14-
<div className="w-full h-screen flex flex-col gap-4 justify-center items-center">
14+
<main className="w-full h-screen" role="alert" aria-live="assertive">
1515
<HeroPattern />
16-
<h2>Something went wrong!</h2>
17-
<Button
18-
variant="primary"
19-
onClick={
20-
// Attempt to recover by trying to re-render the segment
21-
() => reset()
22-
}
23-
>
24-
Try again
25-
</Button>
26-
</div>
16+
<OnboardingNavbar />
17+
<div className="flex flex-col gap-4 justify-center items-center w-full h-full">
18+
<div className="text-center max-w-md px-4">
19+
<h2 className="text-zinc-900 dark:text-zinc-100 font-semibold text-lg">
20+
Something went wrong!
21+
</h2>
22+
<p className="text-zinc-500 dark:text-zinc-400 font-mono text-sm mt-2">
23+
{error.name}: {error.message || 'An unexpected error occurred'}
24+
</p>
25+
</div>
26+
<Button variant="primary" onClick={() => reset()}>
27+
Try again
28+
</Button>
29+
</div>
30+
</main>
2731
)
2832
}

0 commit comments

Comments
 (0)